Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.3   11.4   11.5   12.0   12.1   12.2   12.3   12.4   12.5   13.0    Statistic    FMM    Blog  

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

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


MongoDB.ReleaseAll - MongoDB.ReplaceOne

Feedback: Report problem or ask question.


Start Chat