我在 mongoDb 中存储数据时遇到问题,
这是我的模型:
module.exports = function(app) {
var collection = 'chat_user';
var Schema = app.mongoose.Schema;
var schema = new Schema({
user_id: String,
ws: Object
}, { collection: collection });
this.model = app.db.model(collection, schema);
return this;
};
但是当我尝试存储时:
chat.user = new models.chat_user({
user_id: app.locals.session.user._id,
ws: ws
})
console.log(chat.user)
chat.user.save();
console.log 返回了很好的结果,但我的数据库中什么都没有,也许对象 si 太大了?
如果我删除它,我的 object_id 将存储在我的数据库中
谢谢