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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -