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
A cyclic dependency is an indication of a design or modeling problem in your software. Although you can construct your object graph by using property injection, you will ignore the root cause and add another problem: property injection causes Temporal Coupling. Instead, the solution is to look at the design closely.
Analyze cyclic dependenciesFrom the main menu, select Code | Analyze Code | Cyclic Dependencies. In the Specify Cyclic Dependency Analysis Scope dialog, select the scope of files that you want to analyze. Select the Include test sources option if you want to analyze your test code together with the production code.
This circular relationship caused a problem and webpack could not resolve the dependencies correctly. Our solution was to upgrade our modules to use ES6 import/exports. This enabled us to reuse the react components and avoid circular dependencies while moving us closer to ES standards.
You are setting the newsfeed object back to newsfeed collection. Try to include the field which needs to be updated instead of whole object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With