module CX::Mongo::Query

Constants

VERSION

Public Instance Methods

and( *args ) click to toggle source

LOGICAL OPS

# File lib/cx/mongo_query/operators.rb, line 106
def and( *args ); { $and => args } end
eq( attr, val ) click to toggle source

COMPARISON OPS

# File lib/cx/mongo_query/operators.rb, line 94
def eq(    attr, val   );  { attr.to_s => { $eq  => val  } } end
ge( attr, val ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 97
def ge(    attr, val   );  { attr.to_s => { $gte => val  } } end
gt( attr, val ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 96
def gt(    attr, val   );  { attr.to_s => { $gt  => val  } } end
in( attr, *vals ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 100
def in(    attr, *vals );  { attr.to_s => { $in  => vals } } end
in_s( attr, str ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 102
def in_s(  attr, str   );  { attr.to_s => { $in  => str  } } end
le( attr, val ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 99
def le(    attr, val   );  { attr.to_s => { $lte => val  } } end
lt( attr, val ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 98
def lt(    attr, val   );  { attr.to_s => { $lt  => val  } } end
ne( attr, val ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 95
def ne(    attr, val   );  { attr.to_s => { $ne  => val  } } end
nin( attr, *vals ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 101
def nin(   attr, *vals );  { attr.to_s => { $nin => vals } } end
nin_s( attr, str ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 103
def nin_s( attr, str   );  { attr.to_s => { $nin => str  } } end
nor( *args ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 108
def nor( *args ); { $nor => args } end
not( arg ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 109
def not( arg   ); { $not => arg  } end
or( *args ) click to toggle source
# File lib/cx/mongo_query/operators.rb, line 107
def or(  *args ); { $or  => args } end
rx(pattern, *qualifiers) click to toggle source

REGEX EXPRESSION

# File lib/cx/mongo_query/operators.rb, line 112
def rx(pattern, *qualifiers)
  r = { $regex => pattern }
  qualifiers.each {|q| r.merge!(q)}
  r
end
rxo(string) click to toggle source

REGEX OPTIONS

# File lib/cx/mongo_query/operators.rb, line 119
def rxo(string)
  { $options => string.to_s }
end