Avindu Hewa
Avindu Hewa

Reputation: 1788

Cyclic dependency error with mongodb

        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 enter image description here

Upvotes: 11

Views: 22402

Answers (2)

MUHAMMAD SHAHID RAFI C P
MUHAMMAD SHAHID RAFI C P

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

s7vr
s7vr

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

Related Questions