(MongoDB 2.6) Can't use maxTimeMS with aggreagtion in Pymongo 2.7.1

139 views
Skip to first unread message

Abhishek Vaid

unread,
Jul 11, 2014, 1:42:31 AM7/11/14
to mongod...@googlegroups.com
I want to use maxTimeMS with aggregation query in Pymongo 2.7.1. The underlying mongod is 2.6+ and it supports maxTimeMS.

I tried inspecting the return object from aggregation command in pymongo and it returns a 'dict' object as opposed to a Cursor object.

Is it even possible to use maxTimeMS with aggregation in pymongo 2.7.1?

Urgent help needed!

Bernie Hackett

unread,
Jul 11, 2014, 10:53:47 AM7/11/14
to mongod...@googlegroups.com
>>> c.foo.bar.aggregate([], maxTimeMS=1000)
{u'ok': 1.0, u'result': []}

If you want a cursor:

>>> for result in c.foo.bar.aggregate([], cursor={}, maxTimeMS=1000):
...     print result

The aggregate command didn't support cursors before MongoDB 2.6 so we had to make it an option to avoid breaking existing applications.


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/dbc3394b-8c5d-444b-9945-a7291022d869%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages