【问题标题】:Model seems to have no information with CompoundJS and MongoDB模型似乎没有关于 CompoundJS 和 MongoDB 的信息
【发布时间】:2013-05-13 02:29:24
【问题描述】:

我正在使用 CompoundJS 和 MongoDB (juggling-mongodb)。这是我的代码:

schema.js:

var User = describe('User', function() {
property('_id', Number, {
    index: true
});
property('name', String);
property('email', String);
property('password', String);

set('restPath', pathTo.users);
    setTableName('users');
});

数据库.js:

module.exports = 
 { "development":
    { "driver":   "mongodb",
      "url": "mongodb://admin:1234@localhost/didgeridoo"
    }
 , "test":
    { "driver":   "postgres"
    }
 , "production":
    { "driver":   "postgres"
    }
 };

我正在做:

User.all(function(err, result) {
    //but here result is always empty and there is no error
});

也没有连接问题,集合有数据;)

有人知道它是什么吗?

谢谢!

【问题讨论】:

  • 在下面的答案部分添加您的答案!

标签: node.js mongodb compoundjs jugglingdb


【解决方案1】:

如果有人有同样的疑惑,你必须知道,在撰写本文时,还没有为所有 ORM 实现 setTableName() 方法。希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    • 2016-05-01
    相关资源
    最近更新 更多