lib/mongoid/criteria/queryable/optional.rb in mongoid-6.0.0.beta vs lib/mongoid/criteria/queryable/optional.rb in mongoid-6.0.0.rc0

- old
+ new

@@ -145,11 +145,13 @@ # @since 1.0.0 def only(*args) args = args.flatten option(*args) do |options| options.store( - :fields, args.inject(options[:fields] || {}){ |sub, field| sub.tap { sub[field] = 1 }} + :fields, + args.inject(options[:fields] || {}){ |sub, field| sub.tap { sub[field] = 1 }}, + false ) end end # Adds sorting criterion to the options. @@ -277,10 +279,12 @@ # @since 1.0.0 def without(*args) args = args.flatten option(*args) do |options| options.store( - :fields, args.inject(options[:fields] || {}){ |sub, field| sub.tap { sub[field] = 0 }} + :fields, + args.inject(options[:fields] || {}){ |sub, field| sub.tap { sub[field] = 0 }}, + false ) end end # Associate a comment with the query.