Skip to content

varunmamtora06/mongoindexify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Export Indexes

The main use of this script is to export indexes of one collection to other. The reason for creating this was: I had encountered a situation at my work where in I had to manually create indexes on my local mongo servers collection which were there on production mongodb server. So to reduce manual work, this script was written.

Senerio to use this script

  • Took a data dump of a source collection on a destination db's collection but indexes were not included.
  • Used mongoimport command to create a collection on destination db to import documents from a json type of dump.

Usage

  • Clone the repo and change current working directory to it.
  • Create an env and activate it.
  • Install the requirements: pip install -r requirements.txt
  • Run following
python main.py -src="<source_conn_str>" -srcdb="<source_db>" -srccoll="<source_collectn>" -dest="<dest_conn_str>" -destdb="<dest_db>" -destcoll="<dest_collectn>"

About

Export and Import your mongo indexes without data

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages