Ruby MongoDB combine $ne and $or -


i have query using mongodb drive in ruby, $elements cursor. want x value can except 1, 2 , 3.

here's i've tried.

$elements.find({ "x" => {"$and" => {"$ne" => 1, "$ne" => 2, "$ne" => 3}} }).to_a 

but $and apparently not valid operator. tried this.

$elements.find({ "x" => {"$ne" => {"$or" => [1, 2, 3]}} }).to_a 

but let elements x=1 through anyways.

how accomplish want? also, link might find tutorial or documentation appreciated, can myself next time.

i think want

$elements.find({ "x" => {"$nin" => [1, 2, 3]} }).to_a 

about documentation... http://docs.mongodb.org/manual/reference/operator/


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -