-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Reading the code here and seeing this:
arr._id = arr.id + '';
if(Wordpress.findOne({_id : arr.id + ""})){
Wordpress.upsert(arr._id,arr)
}else{
Wordpress.insert(arr);
}Why do the findOne() and then .upsert() instead of just calling .upsert() directly?
The second parameter to .upsert() should be a Mongo modifier rather than an actual object. I'd guess that the code above doesn't really upsert() a document. It probably needs to be refactored to Wordpress.upsert(arr._id,{$set: arr}) for the .upsert() to succeed.
Metadata
Metadata
Assignees
Labels
No labels