Method: Mongoid::Contextual::Mongo#update_all

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

#update_all(attributes = nil) ⇒ nil, false

Update all the matching documents atomically.

Examples:

Update all the matching documents.

context.update_all({ "$set" => { name: "Smiths" }})

Parameters:

  • attributes (Hash) (defaults to: nil)

    The new attributes for each document.

Returns:

  • (nil, false)

    False if no attributes were provided.

Since:

  • 3.0.0



474
475
476
# File 'lib/mongoid/contextual/mongo.rb', line 474

def update_all(attributes = nil)
  update_documents(attributes, :update_many)
end