Class: Moped::PromiscuousCollectionWrapper
- Inherits:
-
Collection
- Object
- Collection
- Moped::PromiscuousCollectionWrapper
- Defined in:
- lib/promiscuous/publisher/operation/mongoid.rb
Defined Under Namespace
Classes: PromiscuousCollectionOperation
Instance Method Summary collapse
-
#insert(documents, flags = nil) ⇒ Object
Create has its own Operation class, as it’s the only scenario where there is no matching document in the database.
- #promiscuous_create_operation(options) ⇒ Object
Instance Method Details
#insert(documents, flags = nil) ⇒ Object
Create has its own Operation class, as it’s the only scenario where there is no matching document in the database
65 66 67 68 69 70 |
# File 'lib/promiscuous/publisher/operation/mongoid.rb', line 65 def insert(documents, flags=nil) documents = [documents] unless documents.is_a?(Array) documents.each do |doc| promiscuous_create_operation(:document => doc).execute { super(doc, flags) } end end |
#promiscuous_create_operation(options) ⇒ Object
57 58 59 |
# File 'lib/promiscuous/publisher/operation/mongoid.rb', line 57 def promiscuous_create_operation() PromiscuousCollectionOperation.new(.merge(:collection => self, :operation => :create)) end |