mongo dbname --eval 'db.collection.find () " ne fonctionne pas

Pourquoi ce travail:

# mongo dbname
MongoDB shell version: 1.8.3
connecting to: nextmuni_staging
> db.collection.find()
{ "foo" : "bar" }
> bye

Bien que cela ne fonctionne pas:

# mongo localhost/dbname --eval 'db.collection.find()'
MongoDB shell version: 1.8.3
connecting to: localhost/dbname
DBQuery: dbname.collection -> undefined

Il doit être exactement la même, non?

Merci!

  • Eu exactement le même problème. Je remarque 'db.collection.drop()' fonctionne aussi.
InformationsquelleAutor charlax | 2011-09-08