module Minimongo::Query
Public Instance Methods
all(*g)
click to toggle source
# File lib/minimongo/query.rb, line 28 def all(*g); find(*g).to_a; end
count(*g)
click to toggle source
# File lib/minimongo/query.rb, line 27 def count(*g); find(*g).count; end
first(*g)
click to toggle source
First, last, count, all
# File lib/minimongo/query.rb, line 25 def first(*g); find(*g).limit(-1).first; end
last(*g)
click to toggle source
# File lib/minimongo/query.rb, line 26 def last(*g); find(*g).limit(-1).sort(:$natural => -1).first; end
oid(v = nil)
click to toggle source
Creates a BSON::ObjectId from a string, or a new one Use with: oid(string), or oid, oid(:new), oid(nil) to create a new BSON::ObjectId
# File lib/minimongo/query.rb, line 19 def oid(v = nil); BSON::ObjectId.from_string(v) rescue BSON::ObjectId.new; end