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
Post a Comment