1

Using mongoc and MongoDB >= 2.6, how do I set the MaxTimeMS for a find and for a aggregate()?

Dave Wilkin
  • 231
  • 1
  • 3
  • 13

1 Answers1

0

From mongoc driver 1.3.0 on, you can use function mongoc_cursor_set_max_await_time_ms for the cursor. You can take a look at the documentation: http://mongoc.org/libmongoc/1.3.0/mongoc_cursor_set_max_await_time_ms.html.

The document says: "The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. Only applies if the is cursor created from mongoc_collection_find with the query flags MONGOC_QUERY_TAILABLE_CURSOR and MONGOC_QUERY_AWAIT_DATA, and the server is MongoDB 3.2 or later."

Wallace
  • 1
  • 1
  • 1
    Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline. – pableiros Aug 25 '16 at 01:59
  • Thank you for your advice, pableiros – Wallace Aug 26 '16 at 16:20