1MONGOC_COLLECTION_RENAME_WITH_OPTS(3l)ibmongMoOcNGOC_COLLECTION_RENAME_WITH_OPTS(3)
2
3
4

NAME

6       mongoc_collection_rename_with_opts        -       mongoc_collection_re‐
7       name_with_opts()
8

SYNOPSIS

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

PARAMETERS

19collection: A mongoc_collection_t.
20
21new_db: The name of the new database.
22
23new_name: The new name for the collection.
24
25drop_target_before_rename: If an existing collection matches the  new
26         name, drop it before the rename.
27
28error: 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
32writeConcern:   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
36sessionId:  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
43serverId: To target a specific server, include  an  int32  "serverId"
44         field.  Obtain  the  id  by calling mongoc_client_select_server, then
45         mongoc_server_description_id on its return value.
46

DESCRIPTION

48       This function is a helper to rename an existing collection on a MongoDB
49       server.  The  name of the collection will also be updated internally so
50       it is safe to continue using this collection after  the  rename.  Addi‐
51       tional operations will occur on renamed collection.
52
53       If no write concern is provided in opts, the collection's write concern
54       is used.
55

ERRORS

57       Errors are propagated via the error parameter.
58

RETURNS

60       Returns true if successful. Returns false and sets error if  there  are
61       invalid arguments or a server or network error.
62

AUTHOR

64       MongoDB, Inc
65
67       2017-present, MongoDB, Inc
68
69
70
71
721.20.0                           Nov 18, 2M0O2N1GOC_COLLECTION_RENAME_WITH_OPTS(3)
Impressum