libmongo-client  0.1.8
 All Data Structures Functions Variables Enumerations Enumerator Groups Pages
Enumerations | Functions
Commands
Mongo Wire Protocol

Each command has an id parameter, which can be used to track replies to various commands. More...

Collaboration diagram for Commands:

Enumerations

enum  { MONGO_WIRE_FLAG_UPDATE_UPSERT = 0x1, MONGO_WIRE_FLAG_UPDATE_MULTI = 0x2 }
 Flags available for the update command. More...
enum  {
  MONGO_WIRE_FLAG_QUERY_TAILABLE_CURSOR = 1 << 1, MONGO_WIRE_FLAG_QUERY_SLAVE_OK = 1 << 2, MONGO_WIRE_FLAG_QUERY_NO_CURSOR_TIMEOUT = 1 << 4, MONGO_WIRE_FLAG_QUERY_AWAIT_DATA = 1 << 5,
  MONGO_WIRE_FLAG_QUERY_EXHAUST = 1 << 6, MONGO_WIRE_FLAG_QUERY_PARTIAL_RESULTS = 1 << 7
}
 Flags available for the query command. More...
enum  { MONGO_WIRE_FLAG_DELETE_SINGLE = 0x1 }
 Flags available for the delete command. More...

Functions

mongo_packet * mongo_wire_cmd_update (gint32 id, const gchar *ns, gint32 flags, const bson *selector, const bson *update)
 Construct an update command.
mongo_packet * mongo_wire_cmd_insert (gint32 id, const gchar *ns,...) G_GNUC_NULL_TERMINATED
 Construct an insert command.
mongo_packet * mongo_wire_cmd_insert_n (gint32 id, const gchar *ns, gint32 n, const bson **docs)
 Construct an insert command with N documents.
mongo_packet * mongo_wire_cmd_query (gint32 id, const gchar *ns, gint32 flags, gint32 skip, gint32 ret, const bson *query, const bson *sel)
 Construct a query command.
mongo_packet * mongo_wire_cmd_get_more (gint32 id, const gchar *ns, gint32 ret, gint64 cursor_id)
 Construct a get more command.
mongo_packet * mongo_wire_cmd_delete (gint32 id, const gchar *ns, gint32 flags, const bson *sel)
 Construct a delete command.
mongo_packet * mongo_wire_cmd_kill_cursors (gint32 id, gint32 n,...)
 Construct a kill cursors command.
mongo_packet * mongo_wire_cmd_custom (gint32 id, const gchar *db, gint32 flags, const bson *command)
 Construct a custom command.

Detailed Description

Each command has an id parameter, which can be used to track replies to various commands.

It is the responsibility of the caller to keep track of IDs.

Enumeration Type Documentation

anonymous enum

Flags available for the update command.

See Also
mongo_wire_cmd_update().
Enumerator:
MONGO_WIRE_FLAG_UPDATE_UPSERT 

When set, inserts if no matching document was found.

MONGO_WIRE_FLAG_UPDATE_MULTI 

When set, all matching documents will be updated, not just the first.

anonymous enum

Flags available for the query command.

See Also
mongo_wire_cmd_query().
Enumerator:
MONGO_WIRE_FLAG_QUERY_TAILABLE_CURSOR 

Set the TailableCursor flag on the query.

MONGO_WIRE_FLAG_QUERY_SLAVE_OK 

Allow queries made against a replica slave.

MONGO_WIRE_FLAG_QUERY_NO_CURSOR_TIMEOUT 

Disable cursor timeout.

MONGO_WIRE_FLAG_QUERY_AWAIT_DATA 

Block if at the end of the data block, awaiting data.

Use only with MONGO_WIRE_FLAG_QUERY_TAILABLE_CURSOR!

MONGO_WIRE_FLAG_QUERY_EXHAUST 

Stream the data down full blast in multiple packages.

When set, the client is not allowed not to read all the data, unless it closes connection.

MONGO_WIRE_FLAG_QUERY_PARTIAL_RESULTS 

Allow partial results in a sharded environment.

In case one or more required shards are down, with this flag set, partial results will be returned instead of failing.

anonymous enum

Flags available for the delete command.

Enumerator:
MONGO_WIRE_FLAG_DELETE_SINGLE 

Only remove the first match.

Function Documentation

mongo_packet* mongo_wire_cmd_custom ( gint32  id,
const gchar *  db,
gint32  flags,
const bson *  command 
)

Construct a custom command.

Custom commands are queries run in the db.$cmd namespace. The commands themselves are queries, and as such, BSON objects.

Parameters
idis the sequence id.
dbis the database in which the command shall be run.
flagsare the query flags. See mongo_wire_cmd_query() for a list.
commandis the BSON object representing the command.
Returns
A newly allocated packet, or NULL on error. It is the responsibility of the caller to free the packet once it is not used anymore.
mongo_packet* mongo_wire_cmd_delete ( gint32  id,
const gchar *  ns,
gint32  flags,
const bson *  sel 
)