mongoid - How do I query for a specific MongoDB collection field inside Rails Console? -


i have rails 3 app using mongodb, mongoid orm. i'd query specific field within collection.

to query records of particular collection use user.all.to_a, equivalent user.all in activerecord.

now i'd query records within collection, output particular field. in case i'd see user names. how do this?

i'm sure i've stared right @ in mongoid documentation , missing something...

i couldn't locate in new documentation mongoid, here quick link only pointing old 2.x.x documentation.

basically need do:

user.all.only(:name).to_a 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -