Can you use mongodump to dump the latest \"x\" documents from a collection? For example, in the mongo shell you can execute:
db.stats.find().sort({$natural:-1}).
Building off of Mic92's answer, to get the most recent 1000 items from a collection:
Find the _id
of the 1000th most recent item:
db.collection.find('', {'_id':1}).sort({_id:-1}).skip(1000).limit(1)
It will be something like 50ad7bce1a3e927d690385ec
.
Then pass this _id in a query to mongodump:
$ mongodump -d 'your_database' -c 'your_collection' -q '{"_id": {"$gt": {"$oid": "50ad7bce1a3e927d690385ec"}}}'