Module: Mongoid::Relations::Embedded::Batchable
- Defined in:
- lib/patches/atomic.rb
Instance Method Summary collapse
Instance Method Details
#batch_insert(docs) ⇒ Object
353 354 355 |
# File 'lib/patches/atomic.rb', line 353 def batch_insert(docs) execute_batch_insert(docs, "$push", true) end |
#execute_batch_insert(docs, operation, use_each = false) ⇒ Object
357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/patches/atomic.rb', line 357 def execute_batch_insert(docs, operation, use_each = false) self.inserts_valid = true inserts = pre_process_batch_insert(docs) if insertable? collection.find(selector).update( positionally(selector, operation => { path => use_each ? { '$each' => inserts } : inserts }) ) post_process_batch_insert(docs) end inserts end |