I'm trying to print the first document of each collection in my db. I have the following script:
var collectionNames = db.getCollectionNames();
for(var i = 0, len = collectionNames.length; i < len ; i++){
db[collectionNames[i]].findOne() //find[0]
}
I don't see where is the error in my logic but this code only prints the first document from the latest collection