Mongos does not support db.cloneCollection().
1st Method
db.cloneCollection(from, collection, query);
db.cloneCollection(‘mongodb.example.net:27017’, ‘profiles’,{ ‘active’ : true } )
2nd Method depricated since 3.0 version
db.collection.copyTo(“new collection name”); # But its depricated in 3.4 but it works.
3st Method With Mongodump
mongodump –db db-name –collection collection-name –archive=collection-name.archive
For more detail about Clone Collection: Click Here
No comments:
Post a Comment