1
我試圖做一個'找到所有'的資源在一個mongodb集合。mongo find()產生沒有輸出與eval
我可以得到數確定:
mongo ip:port/database1 -u correctusername -p correctpassword
--authenticationDatabase admin --eval "db.getCollection('collection_123').count()"
但是當我嘗試調整它,
mongo ip:port/database1 -u correctusername -p correctpassword
--authenticationDatabase admin --eval "db.getCollection('collection_123').find()"
它產生
MongoDB shell version: 2.4.0
connecting to: ip:port/database1
DBQuery: database1.collection_123 -> { }
我也試過find({})
該重新似乎不是身份驗證錯誤。第一個查詢工作併產生一個計數。我還可以
mongo ip:port/database1 -u correctusername -p correctpassword
--authenticationDatabase admin
進入蒙戈外殼和
db.getCollection('collection_123').find()
而且看到正確的JSON輸出。
關懷給集合名稱?這真的是table123? – Oct
@Oct更新到集合,它只是一個測試集合 – Michael