I am insert the object in mongo db at server side using node js and express js framework and fronted side I am use the angular js.But it is throw the error is that MongoError: key $get must not start with '$'
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]);
}
});
})
display value of contact at console
{ 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}' }
error
MongoError: key $get must not start with '$' Unsuccess
Thank you in advance