Step 1:

set path using command [Tutorial 1]

Step 2:

write in shell : mongo.exe in path of bin folder

for use specific user databse write use <username>

Make one javascript file : shell_script.js

print(“Host Name”);
print(“\t”+hostname());
print(“Date”);
print(“\t”+Date());
db=connect(“localhost/admin”);
print(“Amdin Collections: “);
printjson(db.getCollectionNames());

Save in DBpath directory

Practical 1 : Show Host name , Date and Total no of collection in database

ice_screenshot_20151210-095749

Second Method to execute .js file

ice_screenshot_20151210-100235

 

 

Advertisements