I find that db.collection.copyTo() and eval() have been deprecated since 3.0. But I do not find what can be instead.
What\'s the alternatives?
Create a mongodump of that collection, do mongorestore to a separate or new collection.
This wont stop read/write or wont lock the collection.
mongodump --db db-name --collection collection-name --archive=collection-name.archive
or save as json both works
If saved as archive, to restore
mongorestore --db db-name --collection collection-name --archive=collection-name.archive