Method: Plucky::Query#insert

Defined in:
lib/plucky/query.rb

#insert(document_or_array, driver_opts = {}) ⇒ Object



193
194
195
196
197
198
199
200
201
# File 'lib/plucky/query.rb', line 193

def insert(document_or_array, driver_opts={})
  query = clone

  if document_or_array.is_a?(Array)
    query.collection.insert_many(document_or_array, driver_opts)
  else
    query.collection.insert_one(document_or_array, driver_opts)
  end
end