Reputation: 107
Trying to update a collection and getting invalid syntax from '$'. This script works correctly inside robomongo GUI but not from the terminal..? Probably something simple but I can't seem to figure out why it's giving an error.
collection.update({'title': "Super excited"},{ $set: {"fb_count": 300}}, {multi: true})
Upvotes: 4
Views: 1602
Reputation: 161
In my case, with the same problem, putting the single quotes around $set alone did the trick, although I have not seen that as required in the documentation.
Upvotes: 0
Reputation: 317
try following code, and I think you can specify multi
as argument
collection.update({'title': "Super excited"}, {'$set': {"fb_count": 300}}, multi=True)
pleaser refer to pymongo.collection.Collection.update
Upvotes: 4