Mongoid Collection Return Only Specific Fields

[Solved] Mongoid Collection Return Only Specific Fields | Perl - Code Explorer | yomemimo.com
Question : return only specific fields mongodb

Answered by : annoying-ant-chd232fwd9wi

db.inventory.find( { status: "A" }, { item: 1, status: 1 } )

Source : https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results | Last Update : Thu, 01 Oct 20

Question : mongoid collection return only specific fields

Answered by : tiago-mendes

Map.only(:name).all

Source : https://stackoverflow.com/questions/6687483/mongoid-on-ror3-1-how-to-return-specific-field-on-query-2-what-inverse-of-is | Last Update : Sun, 11 Jul 21

Answers related to mongoid collection return only specific fields

Code Explorer Popular Question For Perl