1MONGOC_COLLECTION_RENAME_WITH_OPMToSn(g3o)DB C DMrOiNvGeOrC_COLLECTION_RENAME_WITH_OPTS(3)
2
3
4
6 mongoc_collection_rename_with_opts - mongoc_collec‐
7 tion_rename_with_opts()
8
10 bool
11 mongoc_collection_rename_with_opts (mongoc_collection_t *collection,
12 const char *new_db,
13 const char *new_name,
14 bool drop_target_before_rename,
15 const bson_t *opts,
16 bson_error_t *error);
17
19 · collection: A mongoc_collection_t.
20
21 · new_db: The name of the new database.
22
23 · new_name: The new name for the collection.
24
25 · drop_target_before_rename: If an existing collection matches the new
26 name, drop it before the rename.
27
28 · error: An optional location for a bson_error_t or NULL.
29
30 opts may be NULL or a BSON document with additional command options:
31
32 · writeConcern: Construct a mongoc_write_concern_t and use mon‐
33 goc_write_concern_append to add the write concern to opts. See the
34 example code for mongoc_client_write_command_with_opts.
35
36 · sessionId: First, construct a mongoc_client_session_t with mon‐
37 goc_client_start_session. You can begin a transaction with mon‐
38 goc_client_session_start_transaction, optionally with a mongoc_trans‐
39 action_opt_t that overrides the options inherited from collection,
40 and use mongoc_client_session_append to add the session to opts. See
41 the example code for mongoc_client_session_t.
42
43 · collation: Configure textual comparisons. See Setting Collation
44 Order, and the MongoDB Manual entry on Collation. Collation requires
45 MongoDB 3.2 or later, otherwise an error is returned.
46
47 · serverId: To target a specific server, include an int32 "serverId"
48 field. Obtain the id by calling mongoc_client_select_server, then
49 mongoc_server_description_id on its return value.
50
52 This function is a helper to rename an existing collection on a MongoDB
53 server. The name of the collection will also be updated internally so
54 it is safe to continue using this collection after the rename. Addi‐
55 tional operations will occur on renamed collection.
56
57 If no write concern is provided in opts, the collection's write concern
58 is used.
59
61 Errors are propagated via the error parameter.
62
64 Returns true if successful. Returns false and sets error if there are
65 invalid arguments or a server or network error.
66
68 MongoDB, Inc
69
71 2017-present, MongoDB, Inc
72
73
74
75
761.14.0 Feb 22, 2M0O1N9GOC_COLLECTION_RENAME_WITH_OPTS(3)