Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MongoDB.Rename

This function is a helper to rename an existing collection on a MongoDB server.

Component Version macOS Windows Linux Server iOS SDK
MongoDB 12.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "MongoDB.Rename"; MongoDBRef; NewDatabase; NewCollectionName { ; DropTargetBeforeRename } )   More

Parameters

Parameter Description Example Flags
MongoDBRef The reference number for the mongo connection. $MongoDB
NewDatabase The new name for the database.
NewCollectionName The new name of the collection.
DropTargetBeforeRename If an existing collection matches the new name, drop it before the rename.
Pass 1 to drop or 0 to not drop and return an error in case of a name collision. Default is 0.
0 Optional

Result

Returns OK or error.

Description

This function is a helper to rename an existing collection on a MongoDB server.
The name of the collection will also be updated internally so it is safe to continue using this collection after the rename. Additional operations will occur on renamed collection.

See also

Release notes

Blog Entries

This function checks for a license.

Created 27th July 2022, last changed 27th July 2022


MongoDB.ReleaseAll - MongoDB.ReplaceOne