# Best way to rename a collection?

**URL:** https://discourse.getcockpit.com/t/best-way-to-rename-a-collection/959
**Category:** Support
**Created:** [August 6, 2019, 4:56pm UTC](https://discourse.getcockpit.com/t/best-way-to-rename-a-collection/959 "2019-08-06T16:56:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jasonday](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jasonday](https://discourse.getcockpit.com/u/jasonday)
#### Post date: [August 6, 2019, 4:56pm UTC](https://discourse.getcockpit.com/t/best-way-to-rename-a-collection/959/1 "2019-08-06T16:56:12Z")

</div>

I’m thinking I can update the MongoDB directly, but I am not aware of relationships that this could effect.

---

<div class="post-metadata">

### Author: ![serjoscha87](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/serjoscha87/32/151_2.png) [@serjoscha87](https://discourse.getcockpit.com/u/serjoscha87)
#### Post date: [September 18, 2019, 6:36pm UTC](https://discourse.getcockpit.com/t/best-way-to-rename-a-collection/959/2 "2019-09-18T18:36:06Z")

</div>

Thats right - collection schemata are also stored on the filesystem within php files. It would take more actions then just rename references within your DB. I guess thats the reason why renaming collections is not possible at the moment. In principle it sould be easy solving this task with an addon. Perhaps one could even put up an workaround that just clones the desired collection, saving it withunder a new name and then remove the original one.

---

<div class="post-metadata">

### Author: ![pauloamgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/pauloamgomes/32/48_2.png) [@pauloamgomes](https://discourse.getcockpit.com/u/pauloamgomes)
#### Post date: [September 24, 2019, 8:17am UTC](https://discourse.getcockpit.com/t/best-way-to-rename-a-collection/959/3 "2019-09-24T08:17:37Z")

</div>

Can’t be performed on DB, collection structure is stored on the filesystem, maybe the following approach works:

1. Clone your collection (copy storage/collections/collection1.php to storage/collections/collection2.php), edit collection2.php and change the name and id
2. Export contents from collection1 using the UI (can be also done in the cli)
3. Import contents into collection2 using the UI
4. Confirm that contents are ok and delete collection1
