Open ramuta opened 5 years ago
TinyMongo allows you to update a document like this:
collection.update_one({"_id": "fh98h43f89fh4fh"}, {"some_field": "some update"})
But on the real MongoDB database (on mLab) I get this error: ValueError: update only works with $ operators.
ValueError: update only works with $ operators
So I needed to change the code like this:
collection.update_one({"_id": "fh98h43f89fh4fh"}, {"$set": {"some_field": "some update"}})
This also works on TinyMongo and it is a more appropriate way to update a document. TinyMongo should follow the MongoDB/pymongo behaviour and throw the same error in the first case.
i have already using $ operators but its giving error: servers.update_one({'_id': str(ctx.guild.id)}, {'$set': {'prefix': prefix}}, upsert=True)
Thank you, works for me.
TinyMongo allows you to update a document like this:
But on the real MongoDB database (on mLab) I get this error:
ValueError: update only works with $ operators
.So I needed to change the code like this:
This also works on TinyMongo and it is a more appropriate way to update a document. TinyMongo should follow the MongoDB/pymongo behaviour and throw the same error in the first case.