Why does MongoDB not allow me to copy one collection into another?
> db.crashntsb.copyTo(crashntsbclean)
2017-01-13T09:09:49.236+0530 E QUERY [main] ReferenceError: crashntsbclean
is not defined :
@(shell):1:1
>
It says the new collection is not defined What could be the reason? Do I need to create the collection? In the documentation it says Mongodb creates this new collection https://docs.mongodb.com/v3.2/reference/method/db.collection.copyTo/
Any help greatly appreciated
the following code will work for you.
db.crashntsb.copyTo("crashntsbclean")
The double quotes is required although the documentation does not say so.