Reputation: 3860
I'm trying to change the value of author where the value is lower than 0 I use this but no result :
db.posts.update({author:{$lt:0}},{$set:{author:582127753}})
any Ideas ?
Upvotes: 3
Views: 1110
Reputation: 5721
By default, the update() method updates a single document that matches its selection criteria. Call the method with the multi option set to true to update multiple documents.
So you should run your query like this:
db.posts.update(
{author:{$lt:0}},
{$set:{author:582127753}},
{ multi: true }
)
Upvotes: 8