Databases

db = Mongo::Connection.new("localhost", 27017).db("mydb")

Collections

db.collection_names.each { |name| puts name }
coll = db.collection("mycollection")

Documents

mydoc = coll.find_one()
puts coll.count()
coll.find().each { |doc| puts doc.inspect }
coll.find({"title" => /^a/})
coll.find({},{:skip => 10, :limit => 20 })