Client API#
- <amongoc/client.h> (header file)#
Contains the following:
Types#
-
struct amongoc_client#
A type that can be used to issue requests to a MongoDB server.
- Header:
Functions#
- amongoc_emitter [[type(amongoc_client*)]] amongoc_client_new(
- amongoc_loop *loop,
- __string_convertible uri,
Asynchronously connect to the remote server at the given location.
- Parameters:
loop – The event loop on which to connect.
uri – A connection URI string specifying the connection parameters.
- Returns:
An
amongoc_emitterthat will resolve with anamongoc_clientpointer- Allocation:
Memory allocation is performed by
loop.- Header:
-
void amongoc_client_delete(amongoc_client *[[transfer, nullable]] cl)#
Destroy the client object, releasing any resources it may have acquired.
- Header:
- amongoc_emitter [[type(bson_doc)]] amongoc_client_command(
- amongoc_client *cl,
- bson_view doc,
- amongoc_emitter [[type(bson_doc)]] amongoc_client_command_nocopy(
- amongoc_client *cl,
- bson_view doc,
Issue a command against the MongoDB server connected with
cl- Parameters:
cl – An
amongoc_clientthat was created withamongoc_client_new().doc – View of a BSON document that defines the command. The
_nocopyversion of this call will not copy the data into the emitter, requiring that the caller ensure the data viewd bydocremains valid until the operation completes.
- Returns:
An
amongoc_emitterthat resolves with abson_doccontaining the server’s response message.- Allocation:
Memory allocation is performed by the event loop of the connection.
- Header:
Note
The command requires a
$dbfield.
-
amongoc_loop *amongoc_client_get_event_loop(amongoc_client const *cl)#
-
mlib_allocator amongoc_client_get_allocator(amongoc_client const *cl)#
Obtain the event loop or allocator associated with the client.