1MONGOC_DATABASE_ADD_USER(3) libmongoc MONGOC_DATABASE_ADD_USER(3)
2
3
4
6 mongoc_database_add_user - mongoc_database_add_user()
7
9 bool
10 mongoc_database_add_user (mongoc_database_t *database,
11 const char *username,
12 const char *password,
13 const bson_t *roles,
14 const bson_t *custom_data,
15 bson_error_t *error);
16
18 · database: A mongoc_database_t.
19
20 · username: The name of the user.
21
22 · password: The cleartext password for the user.
23
24 · roles: An optional bson_t for roles.
25
26 · custom_data: A optional bson_t for extra data.
27
28 · error: A location for a bson_error_t or NULL.
29
30 This function shall create a new user with access to database.
31
32 WARNING:
33 Do not call this function without TLS.
34
36 Errors are returned through the error parameter and can include socket
37 or other server side failures.
38
40 Returns true if the user was successfully added. Returns false and sets
41 error if there are invalid arguments or a server or network error.
42
44 MongoDB, Inc
45
47 2017-present, MongoDB, Inc
48
49
50
51
521.16.2 Feb 25, 2020 MONGOC_DATABASE_ADD_USER(3)