lib/mongo/operation/create/op_msg.rb in mongo-2.17.4 vs lib/mongo/operation/create/op_msg.rb in mongo-2.18.0.beta1
- old
+ new
@@ -29,10 +29,25 @@
private
def selector(connection)
# Collation is always supported on 3.6+ servers that would use OP_MSG.
- spec[:selector].merge(collation: spec[:collation]).compact
+ spec[:selector].merge(
+ collation: spec[:collation],
+ encryptedFields: spec[:encrypted_fields],
+ ).compact.tap do |sel|
+ # This code MUST be removed as soon as server starts accepting
+ # contention as int32.
+ if sel[:encryptedFields] && sel[:encryptedFields].key?('fields')
+ sel[:encryptedFields]['fields'] = sel[:encryptedFields]['fields'].map do |field|
+ if field['queries'] && field['queries'].key?('contention')
+ field['queries']['contention'] = BSON::Int64.new(field['queries']['contention'])
+ end
+ field
+ end
+ end
+ # End of code to be removed
+ end
end
end
end
end
end