Method: Mongoid::Contextual::Atomic#bit

Defined in:
lib/mongoid/contextual/atomic.rb

#bit(bits) ⇒ nil

Perform an atomic $bit operation on the matching documents.

Examples:

Perform the bitwise op.

context.bit(likes: { and: 14, or: 4 })

Parameters:

  • bits (Hash)

    The operations.

Returns:

  • (nil)

    Nil.



46
47
48
# File 'lib/mongoid/contextual/atomic.rb', line 46

def bit(bits)
  view.update_many("$bit" => collect_operations(bits))
end