I have a huge mongodb database and due to the fact that only one thread is writing in a collection at any given time and all the updates are performed on documents that already exist, I'd like mongodb to not acknowledge any operation because I want to boost performance.
I came across a writeConcern rundown here but I have no idea how apply use the unacknowledged write concern on updates in pymongo.
Note: I'm using pymongo 2.7.1, python 3.4 and mongo 2.6.3
Edit: I'd like to add the bulk version of modified write concern update to Neil Lunn's solution.
You can do this in either one of two places.
Either when obtaining the initial MongoClient:
client = MongoClient(w=0)
Or when issuing statements as an additional argument:
result = db.collection.update({ 'a': 1 }, { 'a': 2 }, w=0 )
Both are valid places to specify a write concern. What you specify on MongoClient is "global" for the connection and the other statements override where used or otherwise just use the "global".
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