How to rename database name or collections name in azure document Db? We have set of collections in our documentdb database. Is it possible to change the collection name for other purposes
Asked
Active
Viewed 8,892 times
2 Answers
27
You cannot rename a database or collection. If you must have a different collection name, you'll need to create a new collection and copy your data over.

David Makogon
- 69,407
- 21
- 141
- 189
-
5plus one, but it hurts. – Don Branson May 03 '18 at 21:49
-1
the best option would probably be a proc that takes out data from the one collection and then uploads them to the new collection one by one. By using a proc you can just keep it running until it reaches completion, and then you can delete the now redundant collection. The alternative if you have a lot of data and don't want the hassle is to get all the summary information about said data, store that somewhere and just delete the collection

The Lemon
- 1,211
- 15
- 26
-
This won't actually work - a stored procedure is scoped to a collection (or to a partition, in a partitioned collection). So you can't actually use a stored proc to move data between collections. – David Makogon May 03 '18 at 21:50
-
Also: stored procedures have a time limit of 5 seconds. You can't "just keep it running." – David Makogon Nov 30 '18 at 15:46