mongodb - Fetch all mongoid documents based on condition -
class name usersdata
in mongo
{id:100,createdby:900,.......} {id:200,createdby:900,.......} {id:300,createdby:900,.......} {id:400,createdby:800,.......} {id:500,createdby:800,.......} i want fetch records having createdby=900..i tried this
userdata.where(createdby: 900) but not working
model.where returns criteria. have iterate on results, simplest being userdata.where(createdby:900).to_a array of results.
Comments
Post a Comment