Method: Mongoid::Criteria#only
- Defined in:
- lib/mongoid/criteria.rb
#only(*args) ⇒ Criteria
Overriden to include _type in the fields.
334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/mongoid/criteria.rb', line 334 def only(*args) return clone if args.flatten.empty? args = args.flatten if (args & Fields::IDS).empty? args.unshift(:_id) end if klass.hereditary? super(*args.push(:_type)) else super(*args) end end |