Reputation: 1788
var newsfeed = db.collection('newsfeed');
newsfeed.findAndModify({
_id: mongodb.ObjectId(newsfeedId)
}, {
new: true
}, {
$set: newsfeed
}, function(err, result) {
if (err) {
return reject(err);
} else {
return resolve(result.value);
}
});
I get a cyclic dependency error when i run this query on mongodb, ive read through other solutions presented in stackoverflow but cant seem to fix this error .. this is the error message i see
Upvotes: 11
Views: 22402
Reputation: 1229
you may added some schema restrictions on model with type
try to console the newsfeed
and make sure data you are trying to update matching with schema field type
Upvotes: 0
Reputation: 75914
You are setting the newsfeed object back to newsfeed collection. Try to include the field which needs to be updated instead of whole object.
Upvotes: 15