...
There are a bunch of useful commands to use from Mongo CLI (accessible by typing mongo in your favorite favourite terminal).
show dbs
prints out all databases.show collections
prints out all collections in a database (you'll need touse a_particular_database
first).db.entity.find()
this will print out all documents in entity collection. Not very useful if there are many as it prints out just a few (you'll notice "has more" at the end).db.entity.find({_id : /User.*/})
db.entity.find({_id: { $regex: 'User.*', $options: 'i' } } )
regular expression finder. Expression between / and / is a regular expression, use Use your imagination to narrow your search.
(first example may not work on CLI 2.0.7)db.entity.find({ent:"user"})
instead of regex you may find all entities of a particular type using ent field. This field is the java class name in lower case.- db.entity.find({type:"openacdskill", name:"German"})
narrow the search by applying multiple "filters". db.entity.drop()
drop the entire entity collection.db.entity.find({uid:"200"})
find a particular user document. User names are held in the uid field.db.entity.find({uid:"200"}).forEach(function (d) {printjson(d)})
prints out a formatted version of the document. Pretty useful when looking at a single document. You can also use:db.entity.find({uid:"200"}).forEach(function (d) {printjson(d.prm)})
to see a formatted version of the prm field (permissions).db.entity.find({uid:"200"}).forEach(function (d) {print("_id: "+ d._id +"; perms: "+d.prm)});
print out just a few fields from a particular document
More: http://docs.mongodb.onconfluence.com/display/DOCS/Advanced+Queriesorg/manual/reference/operators/