spec/runners/unified/crud_operations.rb in mongo-2.18.3 vs spec/runners/unified/crud_operations.rb in mongo-2.19.0
- old
+ new
@@ -1,13 +1,21 @@
# frozen_string_literal: true
-# encoding: utf-8
+# rubocop:todo all
module Unified
module CrudOperations
def find(op)
+ get_find_view(op).to_a
+ end
+
+ def find_one(op)
+ get_find_view(op).first
+ end
+
+ def get_find_view(op)
collection = entities.get(:collection, op.use!('object'))
use_arguments(op) do |args|
opts = {
let: args.use('let'),
comment: args.use('comment'),
@@ -35,11 +43,11 @@
req = req.limit(limit)
end
if projection = args.use('projection')
req = req.projection(projection)
end
- result = req.to_a
+ req
end
end
def count_documents(op)
collection = entities.get(:collection, op.use!('object'))
@@ -91,9 +99,10 @@
update = args.use!('update')
opts = {
let: args.use('let'),
comment: args.use('comment'),
hint: args.use('hint'),
+ upsert: args.use('upsert'),
}
if return_document = args.use('returnDocument')
opts[:return_document] = return_document.downcase.to_sym
end
if session = args.use('session')