Guest User

Untitled

a guest
May 23rd, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. > db.help()
  2. DB methods:
  3. db.addUser(username, password[, readOnly=false])
  4. db.auth(username, password)
  5. db.cloneDatabase(fromhost)
  6. db.commandHelp(name) returns the help for the command
  7. db.copyDatabase(fromdb, todb, fromhost)
  8. db.createCollection(name, { size : ..., capped : ..., max : ... } )
  9. db.currentOp() displays the current operation in the db
  10. db.dropDatabase()
  11. db.eval(func, args) run code server-side
  12. db.getCollection(cname) same as db['cname'] or db.cname
  13. db.getCollectionNames()
  14. db.getLastError() - just returns the err msg string
  15. db.getLastErrorObj() - return full status object
  16. db.getMongo() get the server connection object
  17. db.getMongo().setSlaveOk() allow this connection to read from the nonmaster member of a replica pair
  18. db.getName()
  19. db.getPrevError()
  20. db.getProfilingLevel() - deprecated
  21. db.getProfilingStatus() - returns if profiling is on and slow threshold
  22. db.getReplicationInfo()
  23. db.getSiblingDB(name) get the db at the same server as this one
  24. db.isMaster() check replica primary status
  25. db.killOp(opid) kills the current operation in the db
  26. db.listCommands() lists all the db commands
  27. db.logout()
  28. db.printCollectionStats()
  29. db.printReplicationInfo()
  30. db.printSlaveReplicationInfo()
  31. db.printShardingStatus()
  32. db.removeUser(username)
  33. db.repairDatabase()
  34. db.resetError()
  35. db.runCommand(cmdObj) run a database command. if cmdObj is a string, turns it into { cmdObj : 1 }
  36. db.serverStatus()
  37. db.setProfilingLevel(level,<slowms>) 0=off 1=slow 2=all
  38. db.shutdownServer()
  39. db.stats()
  40. db.version() current version of the server
  41. db.getMongo().setSlaveOk() allow queries on a replication slave server
  42. db.fsyncLock() flush data to disk and lock server for backups
  43. db.fsyncUnock() unlocks server following a db.fsyncLock()
Advertisement
Add Comment
Please, Sign In to add comment