Loading...
Searching...
No Matches
Mongo Sync Cursor API
Mongo Sync API
Collaboration diagram for Mongo Sync Cursor API:

## Functions

mongo_sync_cursor * | mongo_sync_cursor_new (mongo_sync_connection *conn, const gchar *ns, mongo_packet *packet)
| Create a new MongoDB Cursor.
gboolean | mongo_sync_cursor_next (mongo_sync_cursor *cursor)
| Iterate a MongoDB cursor.
bson * | mongo_sync_cursor_get_data (mongo_sync_cursor *cursor)
| Retrieve the BSON document at the cursor's position.
void | mongo_sync_cursor_free (mongo_sync_cursor *cursor)
| Free a MongoDB cursor.

## Detailed Description

## Function Documentation

## mongo_sync_cursor_free()

void mongo_sync_cursor_free | ( | mongo_sync_cursor * | cursor | ) |

Free a MongoDB cursor.

Freeing a MongoDB cursor involves destroying the active cursor the database is holding, and then freeing up the resources allocated for it.

Parameters

  cursor | is the cursor to destroy.

## mongo_sync_cursor_get_data()

bson * mongo_sync_cursor_get_data | ( | mongo_sync_cursor * | cursor | ) |

Retrieve the BSON document at the cursor's position.

Parameters

  cursor | is the cursor to retrieve data from.

Returns
  A newly allocated BSON object, or NULL on failure. It is the responsiblity of the caller to free the BSON object once it is no longer needed.

## mongo_sync_cursor_new()

mongo_sync_cursor * mongo_sync_cursor_new | ( | mongo_sync_connection * | conn,
|  | const gchar * | ns,
|  | mongo_packet * | packet )

Create a new MongoDB Cursor.

This function can be used to create a new cursor, with which one can conveniently iterate over using mongo_sync_cursor_next().

The packet argument is supposed to be the output of - for example - mongo_sync_cmd_query().

Parameters

  conn | is the connection to associate with the cursor.
  ns | is the namespace to use with the cursor.
  packet | is a reply packet on which the cursor should be based. The packet should not be freed or touched by the application afterwards, it will be handled by the cursor functions.

Returns
  A newly allocated cursor, or NULL on error.

## mongo_sync_cursor_next()

gboolean mongo_sync_cursor_next | ( | mongo_sync_cursor * | cursor | ) |

Iterate a MongoDB cursor.

Iterating the cursor will move its position to the next document in the result set, querying the database if so need be.

Queries will be done in bulks, provided that the original query was done so aswell.

Parameters

  cursor | is the cursor to advance.

Returns
  TRUE if the cursor could be advanced, FALSE otherwise. If the cursor could not be advanced due to an error, then errno will be set appropriately.