0
我在保存mongodb(Mongoose)中的json对象时遇到问题,所以当我插入一切正常,但是当我提出相同对象的请求时,Mongoose返回一个修改JSON。它像Mongoose自动完成Twitter领域,我不知道为什么。在Mongoose中保存/加载json对象之间的区别
这里是我的代码:
UserSchema = mongoose.Schema({
firstName: String,
lastName: String,
email: String,
salt: String,
hash: String,
twitter:{
id: String,
email: String,
name: String
},
facebook:{
id: String,
email: String,
name: String,
username: String,
photo: String,
gender: String
}
});
我救JSON在我的数据库:
User.create({
email : profile.emails[0].value,
facebook : {
id: profile.id,
email: profile.emails[0].value,
name: profile.displayName,
username: profile.username,
photo: profile.photos[0].value,
gender: profile.gender
}
}, function(err, user){
if(err) throw err;
// if (err) return done(err);
done(null, user);
});
但我当猫鼬返回JSON。
猫鼬在JSON产生的场。推特:{} < ----
我不知道为什么,有人可以借我一只手吗?
我解决了你的答案的问题,我用JSON函数和它的工作很好。谢谢 – slorenzo