PRACTICE+-+5 1+to+5 4+-+Introduction+to+MongoDB+Shell
PRACTICE+-+5 1+to+5 4+-+Introduction+to+MongoDB+Shell
Shell
- Firoj Atar
• Code :
cmdCount = 1;
prompt = function() {
return (cmdCount++) + "> ";
}
• Result
1>
2>
3>
• Code
host = db.serverStatus().host;
prompt = function() {
return db+"@"+host+"$ ";
}
• Result
test@myHost1$
Codeprompt = function() {
return "Uptime:"+db.serverStatus().uptime+" Documents:"+db.stats().objects+"
> ";
}
• Result
• Uptime:5897 Documents:6 >
• Shell help
• help
• Database help
• db.help()
• Collection help
• db.collection.help()
• Curson help
• db.collection.find().help()