标签: ruby-on-rails ruby mongodb mongoid
如何执行不返回整个文档的查询,只执行我指定的字段?
答案 0 :(得分:20)
从马的嘴里说:
# Return only the first and last names of each person. Person.only(:first_name, :last_name)
来源:http://mongoid.org/docs/querying/criteria.html#only