Reputation: 16940
I m trying to update a docs field using pymongo as below:
query = {"node_name": "1"}
set_docs = {"$set": {'shipped_date': 'N/A', 'support_end_date': 'N/A'}
mongodb.update(query, {"$set": set_docs}, upsert=False}
The above command throwing error:
pymongo.errors.WriteError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
Is it possible to use the dict object, instead of key: value in $set.
Upvotes: 0
Views: 474
Reputation: 13113
Code error:
set_docs = {"$set": {'shipped_date': 'N/A', 'support_end_date': 'N/A'}}
mongodb.update(query, set_docs, upsert=False}
Upvotes: 2