globalsign / mgo

The MongoDB driver for Go
Other
1.97k stars 232 forks source link

How does mgo run the mongodb shell? #359

Closed houzhongjian closed 5 years ago

houzhongjian commented 5 years ago

i want to use mgo run mongodb shell !! like db.Query("db.user.find({name:"jack"})") but I don't know which API to use.

houzhongjian commented 5 years ago

oh cannot use this method to execute the mongodb shell !!!

The following is the right way

$ mongo 127.0.0.1/demo --authenticationDatabase 'admin' --username 'jiuzhou' --password 'jiuzhou' --quiet --eval="db.user.find().limit(10)";