giving an array of object below:
myarray: [ '{"id":"id1","ts":"ts1","lat":"lat1","lon":"lon1"}',
'{"id":"id2","ts":"ts2","lat":"lat2","lon":"lon2"}',
'{"id":"id3","ts":"ts3","lat":"lat3","lon":"lon3"}' ]
I want to save it in mongo database by using mongoose, this is my code:
for(var obj in myarray){
var doc = new MyCollection(myarray[obj])
sigfoxData.save()
.catch((err=>{console.log(error.message);}))
}
But I get this error when executing the code:
TypeError: Cannot use 'in' operator to search for '_id' in {"id":"id1","ts":"ts1","lat":"lat1","lon":"lon1"}
I don't find the source of the error. Can you help me please?
via Blackhat
No comments:
Post a Comment