I have a big MongoDB collection named ebola
. I need to extract a subset of its first 1000 documents and save them into a new collection called sample
. The code should be something like this:
db.createCollection("sample")
db.sample.insert(db.ebola.find({}).limit(1000))
But what is wrong with it?