Moped

Moped is a MongoDB driver for Ruby, which exposes a simple, elegant, and fast API. Moped is the supported driver for Mongoid from version 3 and higher.

Moped is composed of three parts: an implementation of the BSON specification, an implementation of the Mongo Wire Protocol, and the driver itself.

Sample Syntax

Moped only supports MRI 1.9.3, and HEAD, and JRuby 1.6.0+ in 1.9 mode. All code samples will use 1.9 syntax.
session = Moped::Session.new([ "127.0.0.1:27017" ])
session.use "echo_test"

session.with(safe: true) do |safe|
  safe[:artists].insert(name: "Syd Vicious")
end

session[:artists].find(name: "Syd Vicious").update(:$push => { instruments: { name: "Bass" }})