How to specify readConcern in Motor 0.6.2 / PyMongo 2.8 ?

48 views
Skip to first unread message

Andrew

unread,
May 30, 2016, 9:05:47 PM5/30/16
to mongodb-user
Hello!

I'm using MongoDB 3.2 and current stable version of Motor.

Can "readConcern" option be specified as a keyword argument in motor.motor_tornado.MotorCollection methods?

How to make sure that readConcern option is applied on MongoDB side? I have not found any mention of readConcern in MongoDB log.

Thanks.

A. Jesse Jiryu Davis

unread,
May 31, 2016, 2:53:08 PM5/31/16
to mongodb-user
Motor wraps PyMongo 2.8, which does not have built in support for read concern. If you tell me which operations specifically you need to apply read concern to--find, count, aggregate, or whatever--I can show you how to pass read concern manually.

Andrew

unread,
May 31, 2016, 7:51:02 PM5/31/16
to mongodb-user
I basically just need to specify readConcern for "find_one" and "find" operations.

Correct me if I'm wrong, but I think that MotorDatabase.command is suitable in this case, so instead of "db.collection.find()" I could use:

doc = await db.command(
'find',
    'collection',
filter={'_id': _id},
readConcern={'level': 'majority'},
singleBatch=True)

A. Jesse Jiryu Davis

unread,
May 31, 2016, 8:10:31 PM5/31/16
to mongod...@googlegroups.com
Yes exactly! Let me know if you need anything more from me.

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/JF6VsDXCHms/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/da42569b-bfca-4f5d-b62a-2434ac1dd787%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages