MONGOC_COLLECTION_RENAME(3)
π MONGOC_COLLECTION_RENAME(3) β the libmongoc glow-up your collection deserves
okay bestie, so you wanna rename a collection? say less. this is a libmongoc thing, and it's genuinely one of the simpler little functions in the whole library β a real "just vibes" moment. β¨
π¦ SYNOPSIS
bool
mongoc_collection_rename (mongoc_collection_t *collection,
const char *new_db,
const char *new_name,
bool drop_target_before_rename,
bson_error_t *error);
that's it. that's the whole signature. it returns a bool, and honestly the bool is the main character here β you gotta check it. π₯
π PARAMETERS
collectionβ Amongoc_collection_t. this is your collection, your fave, the one getting the makeover. πnew_dbβ The name of the new database. yes, you can move it to a whole different database. it's giving relocation era. π¦new_nameβ The new name for the collection. pick something cute, or pick something boring, no judgement, it's your life.drop_target_before_renameβ If an existing collection matches the new name, drop it before the rename. β οΈ heads up β this one is the "yikes" flag, because if something's already sitting there with that name, it gets dropped. like, gone. so be sure before you set this totrue, fr fr.errorβ An optional location for abson_error_torNULL. you can passNULLif you're feeling fearless (or just want to ignore errors, whichβ¦ bestie, no, but do you). π
πΈ DESCRIPTION
okay so here's the tea: for more information, see mongoc_collection_rename_with_opts(). this function is a thin wrapper, passing NULL in as bson_t parameter. π«Ά
so like, it's literally just mongoc_collection_rename_with_opts() wearing a slightly simpler outfit. if you want the options, go to that one. if you want the no-frills version, you're already here, and you're slaying. π
ngl, "thin wrapper" is doing a lot of work in that sentence, but that's genuinely all it is β no hidden behaviour, no extra steps, just theNULLbson_tand off you go. β¨
π AUTHOR
MongoDB, Inc
π COPYRIGHT
2009-present, MongoDB, Inc.
and that's the page, bestie! π this lil' slice of libmongoc is version 2.5.6, dated Oct 09, 2026, brought to you by the fine people at MongoDB, Inc β go rename something iconic, and remember to check that bool. ππ
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms