2

I want to clone a collection to a backup collection, before processing all the entries in it through my Spring controller.

On searching, I came to know about various ways to do so through terminal. There is also a possibility to use executeCommand menthod to directly execute mongodb commands (copyTo command in my case). But again, I could not find a way to do so.

Could somebody please provide me any pointers on this?

Vishal
  • 189
  • 3
  • 11

1 Answers1

0

you can setup JMX support to your project: http://static.springsource.org/spring-data/data-document/docs/current/reference/html/ , see "Chapter 10. JMX support" section, you will be able to get an administrative MBean, MongoAdmin which will let you perform administrative operations such as drop or create a database, and execute one of your solution candidates, like execute mongodump(http://docs.mongodb.org/manual/reference/mongodump/#cmdoption-mongodump--collection) and mongorestore(http://docs.mongodb.org/manual/reference/mongorestore/#cmdoption-mongorestore--collection) for a simgle collection, during restoration you can indicate the new collection name.

Regards, Moacy

Moacy Barros
  • 1,869
  • 13
  • 9