Method 1 :Using javascript file

Step 1:

Write this code in list_user.js

mongo = new Mongo(“localhost”);
db=mongo.getDB(“test”);
cur=db.system.users.find();
printjson(cur.toArray());

Write Command in console:

mongo list_user.js

 

Method  2: Using Shell script command

ice_screenshot_20151210-103410

Advertisements