我使用节点插入JS在服务器侧蒙戈DB对象和表达JS框架和主音方面,我使用的角度js.But它抛出的错误是开始这MongoError:在控制台接触的关键$ GET不能以 '$' 开始
server.js
app
.use(bodyParser.json())
.post('/contact', upload.single('file'), function(req,res){
var contact = req.body;
delete contact.$promise;
delete contact.$resolved;
console.log(contact);
//console.log(req.file);
contact.userId = 1;
db.collection(CONTACTS_COLLECTION).insertOne(contact, function(err, doc) {
if (err) {
console.log(err + " Unsuccess");
} else {
console.log(doc.ops[0]);
res.status(201).json(doc.ops[0]);
}
});
})
显示值
{ firstName: 'abc,text',
lastName: 'abc,text',
toJSON: 'function(){var a=v({},this);delete a.$promise;delete a.$resolved;return a}',
'$get': 'function (a,b,d){x(a)&&(d=b,b=a,a= {});a=m[c].call(this,a,this,b,d);return a.$promise||a}',
'$save': 'function (a,b,d){x(a)&&(d=b,b=a,a={});a=m[c].call(this,a,this,b,d);return a.$promise||a}',
'$query': 'function (a,b,d){x(a)&&(d=b,b=a,a={});a=m[c].call(this,a,this,b,d);return a.$promise||a}',
'$remove': 'function (a,b,d){x(a)&&(d=b,b=a,a={});a=m[c].call(this,a,this,b,d);return a.$promise||a}',
'$delete': 'function (a,b,d){x(a)&&(d=b,b=a,a={});a=m[c].call(this,a,this,b,d);return a.$promise||a}',
'$update': 'function (a,b,d){x(a)&&(d=b,b=a,a={});a=m[c].call(this,a,this,b,d);return a.$promise||a}' }
错误
MongoError: key $get must not start with '$' Unsuccess
预先感谢您
我想存储在数据库 – VishalPethani