MongoDB import/export indexes -


i need tool rapidly recreating proper "schema" (such is) of mongodb instances between environments pre-creates right db names, collections, sets collection caps, , creates indexes each collection. not want copy of data between instances, though. each env manage has different data db/collection/caps/indexes same. there easy way this, preferably tool exports json doc of names, caps , indexes can re-imported new instance?

after didn't find appropriate tool, dumped database , restored without data, metadata restored (particularly collections created apropriate indexes), collections empty. can applied databases data well, indexes created on existing db if there no conflict.

1.make dump mongodump

2.empty data of collections

find ./dump -name '*bson' -type f -exec cp /dev/null {} \;

3.restore data new db mongorestore


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -