Meteor 集合插入正在插入子文档而不是普通文档。请参阅下面的插入语句:
return Profile.insert({
_id: this.userId,
"firstName": firstname,
"lastName": lastname,
"state": state,
"mobile": mobile,
"alias": alias,
"email": email,
"bvn": bvn,
"createdAt": new Date(),
"updatedAt": new Date(),
});
这是 MongoDB 控制台中的结果:
meteor:PRIMARY> db.profile.find().pretty()
{
"_id" : "uNECMJJkCtQXhSs33",
**"firstName" : {
"firstName" : "firstName",
"lastName" : "lastName",
"state" : "state",
"mobile" : 55325235522535,
"alias" : "alias",
"email" : "email",
"bvn" : 6364634664
},**
"createdAt" : ISODate("2018-12-15T03:23:33.243Z"),
"updatedAt" : ISODate("2018-12-15T03:23:33.243Z")
}
下面是我的期望
meteor:PRIMARY> db.profile.find().pretty()
{
"_id" : "uNECMJJkCtQXhSs33",
"firstName" : "firstName",
"lastName" : "lastName",
"state" : "state",
"mobile" : 55325235522535,
"alias" : "alias",
"email" : "email",
"bvn" : 6364634664
"createdAt" : ISODate("2018-12-15T03:23:33.243Z"),
"updatedAt" : ISODate("2018-12-15T03:23:33.243Z")
}