SYNOPSIS

mongoc_cursor_t *
mongoc_collection_find (mongoc_collection_t       *collection,
                        mongoc_query_flags_t       flags,
                        uint32_t                   skip,
                        uint32_t                   limit,
                        uint32_t                   batch_size,
                        const bson_t              *query,
                        const bson_t              *fields,
                        const mongoc_read_prefs_t *read_prefs);

DESCRIPTION

The mongoc_collection_find() function shall execute a query on the underlying collection. The bson query is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.

FLAGS

MONGOC_QUERY_NONE

No query flags supplied.

MONGOC_QUERY_TAILABLE_CURSOR

Cursor will not be closed when the last data is retrieved. You can resume this cursor later.

MONGOC_QUERY_SLAVE_OK

Allow query of replica slave.

MONGOC_QUERY_OPLOG_REPLAY

Used internally by Mongo.

MONGOC_QUERY_NO_CURSOR_TIMEOUT

The server normally times out idle cursors after an inactivity period (10 minutes). This prevents that.

MONGOC_QUERY_AWAIT_DATA

Use with MONGOC_QUERY_TAILABLE_CURSOR. Block rather than returning no data. After a period, time out.

MONGOC_QUERY_EXHAUST

Stream the data down full blast in multiple "more" packages. Faster when you are pulling a lot of data and know you want to pull it all down.

MONGOC_QUERY_PARTIAL

Get partial results from mongos if some shards are down (instead of throwing an error).

RETURN VALUE

The mongoc_collection_find() function returns a mongoc_cursor(7). In the event of failure, NULL is returned.

ERRORS

errors are returned through error

SEE ALSO

AUTHORS

This page was written by MongoDB Inc.