1MONGOC_CLIENT_GET_DATABASE_NAMES_WMIOTlNHiG_bOOmCPo_TnCSgL(oI3cE)NT_GET_DATABASE_NAMES_WITH_OPTS(3)
2
3
4

NAME

6       mongoc_client_get_database_names_with_opts   -  mongoc_client_get_data‐
7       base_names_with_opts()
8

SYNOPSIS

10          char **
11          mongoc_client_get_database_names_with_opts (mongoc_client_t *client,
12                                                      const bson_t *opts,
13                                                      bson_error_t *error);
14
15       This function queries the MongoDB server for a list of known databases.
16

PARAMETERS

18       · client: A mongoc_client_t.
19
20       · opts: A bson_t containing additional options.
21
22       · error: An optional location for a bson_error_t or NULL.
23
24       opts may be NULL or a BSON document with additional command options:
25
26       · sessionId:  First,  construct  a  mongoc_client_session_t  with  mon‐
27         goc_client_start_session.  You  can  begin  a  transaction  with mon‐
28         goc_client_session_start_transaction, optionally with a mongoc_trans‐
29         action_opt_t  that  overrides  the options inherited from client, and
30         use mongoc_client_session_append to add the session to opts. See  the
31         example code for mongoc_client_session_t.
32
33       · serverId:  To  target  a specific server, include an int32 "serverId"
34         field. Obtain the id  by  calling  mongoc_client_select_server,  then
35         mongoc_server_description_id on its return value.
36
37       This  function  is considered a retryable read operation.  Upon a tran‐
38       sient error (a network error, errors due to replica set failover, etc.)
39       the  operation  is  safely retried once.  If retryreads is false in the
40       URI (see mongoc_uri_t) the retry behavior does not apply.
41

ERRORS

43       Errors are propagated via the error parameter.
44

RETURNS

46       A NULL terminated vector of NULL-byte terminated  strings.  The  result
47       should be freed with bson_strfreev().
48
49       NULL is returned upon failure and error is set.
50

EXAMPLES

52          {
53             bson_error_t error;
54             char **strv;
55             unsigned i;
56
57             if ((strv = mongoc_client_get_database_names_with_opts (client, NULL, &error))) {
58                for (i = 0; strv[i]; i++)
59                   printf ("%s\n", strv[i]);
60                bson_strfreev (strv);
61             } else {
62                fprintf (stderr, "Command failed: %s\n", error.message);
63             }
64          }
65

AUTHOR

67       MongoDB, Inc
68
70       2017-present, MongoDB, Inc
71
72
73
74
751.17.4                           FMeObNG0O4C,_C2L0I2E1NT_GET_DATABASE_NAMES_WITH_OPTS(3)
Impressum