PYTHON-2142 Add index hinting support to delete operations
This commit is contained in:
parent
016f8de965
commit
b65fdf3f51
@ -218,7 +218,7 @@ class _Bulk(object):
|
||||
cmd['hint'] = hint
|
||||
self.ops.append((_UPDATE, cmd))
|
||||
|
||||
def add_delete(self, selector, limit, collation=None):
|
||||
def add_delete(self, selector, limit, collation=None, hint=None):
|
||||
"""Create a delete document and add it to the list of ops.
|
||||
"""
|
||||
cmd = SON([('q', selector), ('limit', limit)])
|
||||
@ -226,6 +226,9 @@ class _Bulk(object):
|
||||
if collation is not None:
|
||||
self.uses_collation = True
|
||||
cmd['collation'] = collation
|
||||
if hint is not None:
|
||||
self.uses_hint = True
|
||||
cmd['hint'] = hint
|
||||
if limit == _DELETE_ALL:
|
||||
# A bulk_write containing a delete_many is not retryable.
|
||||
self.is_retryable = False
|
||||
|
||||
@ -1125,7 +1125,7 @@ class Collection(common.BaseObject):
|
||||
def _delete(
|
||||
self, sock_info, criteria, multi,
|
||||
write_concern=None, op_id=None, ordered=True,
|
||||
collation=None, session=None, retryable_write=False):
|
||||
collation=None, hint=None, session=None, retryable_write=False):
|
||||
"""Internal delete helper."""
|
||||
common.validate_is_mapping("filter", criteria)
|
||||
write_concern = write_concern or self.write_concern
|
||||
@ -1142,6 +1142,16 @@ class Collection(common.BaseObject):
|
||||
'Collation is unsupported for unacknowledged writes.')
|
||||
else:
|
||||
delete_doc['collation'] = collation
|
||||
if hint is not None:
|
||||
if sock_info.max_wire_version < 5:
|
||||
raise ConfigurationError(
|
||||
'Must be connected to MongoDB 3.4+ to use hint.')
|
||||
elif not acknowledged:
|
||||
raise ConfigurationError(
|
||||
'hint is unsupported for unacknowledged writes.')
|
||||
if not isinstance(hint, string_type):
|
||||
hint = helpers._index_document(hint)
|
||||
delete_doc['hint'] = hint
|
||||
command = SON([('delete', self.name),
|
||||
('ordered', ordered),
|
||||
('deletes', [delete_doc])])
|
||||
@ -1171,20 +1181,20 @@ class Collection(common.BaseObject):
|
||||
def _delete_retryable(
|
||||
self, criteria, multi,
|
||||
write_concern=None, op_id=None, ordered=True,
|
||||
collation=None, session=None):
|
||||
collation=None, hint=None, session=None):
|
||||
"""Internal delete helper."""
|
||||
def _delete(session, sock_info, retryable_write):
|
||||
return self._delete(
|
||||
sock_info, criteria, multi,
|
||||
write_concern=write_concern, op_id=op_id, ordered=ordered,
|
||||
collation=collation, session=session,
|
||||
collation=collation, hint=hint, session=session,
|
||||
retryable_write=retryable_write)
|
||||
|
||||
return self.__database.client._retryable_write(
|
||||
(write_concern or self.write_concern).acknowledged and not multi,
|
||||
_delete, session)
|
||||
|
||||
def delete_one(self, filter, collation=None, session=None):
|
||||
def delete_one(self, filter, collation=None, hint=None, session=None):
|
||||
"""Delete a single document matching the filter.
|
||||
|
||||
>>> db.test.count_documents({'x': 1})
|
||||
@ -1200,18 +1210,24 @@ class Collection(common.BaseObject):
|
||||
- `collation` (optional): An instance of
|
||||
:class:`~pymongo.collation.Collation`. This option is only supported
|
||||
on MongoDB 3.4 and above.
|
||||
- `hint` (optional): An index to use to support the query
|
||||
predicate specified either by its string name, or in the same
|
||||
format as passed to
|
||||
:meth:`~pymongo.collection.Collection.create_index` (e.g.
|
||||
``[('field', ASCENDING)]``). This option is only supported on
|
||||
MongoDB 4.4 and above.
|
||||
- `session` (optional): a
|
||||
:class:`~pymongo.client_session.ClientSession`.
|
||||
|
||||
:Returns:
|
||||
- An instance of :class:`~pymongo.results.DeleteResult`.
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
Added ``hint`` parameter.
|
||||
.. versionchanged:: 3.6
|
||||
Added ``session`` parameter.
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
Added the `collation` option.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
"""
|
||||
write_concern = self._write_concern_for(session)
|
||||
@ -1219,10 +1235,10 @@ class Collection(common.BaseObject):
|
||||
self._delete_retryable(
|
||||
filter, False,
|
||||
write_concern=write_concern,
|
||||
collation=collation, session=session),
|
||||
collation=collation, hint=hint, session=session),
|
||||
write_concern.acknowledged)
|
||||
|
||||
def delete_many(self, filter, collation=None, session=None):
|
||||
def delete_many(self, filter, collation=None, hint=None, session=None):
|
||||
"""Delete one or more documents matching the filter.
|
||||
|
||||
>>> db.test.count_documents({'x': 1})
|
||||
@ -1238,18 +1254,24 @@ class Collection(common.BaseObject):
|
||||
- `collation` (optional): An instance of
|
||||
:class:`~pymongo.collation.Collation`. This option is only supported
|
||||
on MongoDB 3.4 and above.
|
||||
- `hint` (optional): An index to use to support the query
|
||||
predicate specified either by its string name, or in the same
|
||||
format as passed to
|
||||
:meth:`~pymongo.collection.Collection.create_index` (e.g.
|
||||
``[('field', ASCENDING)]``). This option is only supported on
|
||||
MongoDB 4.4 and above.
|
||||
- `session` (optional): a
|
||||
:class:`~pymongo.client_session.ClientSession`.
|
||||
|
||||
:Returns:
|
||||
- An instance of :class:`~pymongo.results.DeleteResult`.
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
Added ``hint`` parameter.
|
||||
.. versionchanged:: 3.6
|
||||
Added ``session`` parameter.
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
Added the `collation` option.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
"""
|
||||
write_concern = self._write_concern_for(session)
|
||||
@ -1257,7 +1279,7 @@ class Collection(common.BaseObject):
|
||||
self._delete_retryable(
|
||||
filter, True,
|
||||
write_concern=write_concern,
|
||||
collation=collation, session=session),
|
||||
collation=collation, hint=hint, session=session),
|
||||
write_concern.acknowledged)
|
||||
|
||||
def find_one(self, filter=None, *args, **kwargs):
|
||||
@ -2849,10 +2871,8 @@ class Collection(common.BaseObject):
|
||||
|
||||
.. versionchanged:: 3.6
|
||||
Added ``session`` parameter.
|
||||
|
||||
.. versionchanged:: 3.4
|
||||
Added the `collation` option.
|
||||
|
||||
"""
|
||||
res = self._map_reduce(map, reduce, {"inline": 1}, session,
|
||||
self.read_preference, **kwargs)
|
||||
@ -2931,7 +2951,8 @@ class Collection(common.BaseObject):
|
||||
write_concern.acknowledged, _find_and_modify, session)
|
||||
|
||||
def find_one_and_delete(self, filter,
|
||||
projection=None, sort=None, session=None, **kwargs):
|
||||
projection=None, sort=None, hint=None,
|
||||
session=None, **kwargs):
|
||||
"""Finds a single document and deletes it, returning the document.
|
||||
|
||||
>>> db.test.count_documents({'x': 1})
|
||||
@ -2968,15 +2989,21 @@ class Collection(common.BaseObject):
|
||||
- `sort` (optional): a list of (key, direction) pairs
|
||||
specifying the sort order for the query. If multiple documents
|
||||
match the query, they are sorted and the first is deleted.
|
||||
- `hint` (optional): An index to use to support the query predicate
|
||||
specified either by its string name, or in the same format as
|
||||
passed to :meth:`~pymongo.collection.Collection.create_index`
|
||||
(e.g. ``[('field', ASCENDING)]``). This option is only supported
|
||||
on MongoDB 4.4 and above.
|
||||
- `session` (optional): a
|
||||
:class:`~pymongo.client_session.ClientSession`.
|
||||
- `**kwargs` (optional): additional command arguments can be passed
|
||||
as keyword arguments (for example maxTimeMS can be used with
|
||||
recent server versions).
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
Added ``hint`` parameter.
|
||||
.. versionchanged:: 3.6
|
||||
Added ``session`` parameter.
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
Respects write concern.
|
||||
|
||||
@ -2989,11 +3016,10 @@ class Collection(common.BaseObject):
|
||||
.. versionchanged:: 3.4
|
||||
Added the `collation` option.
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
kwargs['remove'] = True
|
||||
return self.__find_and_modify(filter, projection, sort,
|
||||
session=session, **kwargs)
|
||||
hint=hint, session=session, **kwargs)
|
||||
|
||||
def find_one_and_replace(self, filter, replacement,
|
||||
projection=None, sort=None, upsert=False,
|
||||
|
||||
@ -57,9 +57,9 @@ class InsertOne(object):
|
||||
class DeleteOne(object):
|
||||
"""Represents a delete_one operation."""
|
||||
|
||||
__slots__ = ("_filter", "_collation")
|
||||
__slots__ = ("_filter", "_collation", "_hint")
|
||||
|
||||
def __init__(self, filter, collation=None):
|
||||
def __init__(self, filter, collation=None, hint=None):
|
||||
"""Create a DeleteOne instance.
|
||||
|
||||
For use with :meth:`~pymongo.collection.Collection.bulk_write`.
|
||||
@ -69,18 +69,31 @@ class DeleteOne(object):
|
||||
- `collation` (optional): An instance of
|
||||
:class:`~pymongo.collation.Collation`. This option is only
|
||||
supported on MongoDB 3.4 and above.
|
||||
- `hint` (optional): An index to use to support the query
|
||||
predicate specified either by its string name, or in the same
|
||||
format as passed to
|
||||
:meth:`~pymongo.collection.Collection.create_index` (e.g.
|
||||
``[('field', ASCENDING)]``). This option is only supported on
|
||||
MongoDB 4.4 and above.
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
Added the ``hint`` option.
|
||||
.. versionchanged:: 3.5
|
||||
Added the `collation` option.
|
||||
"""
|
||||
if filter is not None:
|
||||
validate_is_mapping("filter", filter)
|
||||
if hint is not None:
|
||||
if not isinstance(hint, string_type):
|
||||
hint = helpers._index_document(hint)
|
||||
self._filter = filter
|
||||
self._collation = collation
|
||||
self._hint = hint
|
||||
|
||||
def _add_to_bulk(self, bulkobj):
|
||||
"""Add this operation to the _Bulk instance `bulkobj`."""
|
||||
bulkobj.add_delete(self._filter, 1, collation=self._collation)
|
||||
bulkobj.add_delete(self._filter, 1, collation=self._collation,
|
||||
hint=self._hint)
|
||||
|
||||
def __repr__(self):
|
||||
return "DeleteOne(%r, %r)" % (self._filter, self._collation)
|
||||
@ -98,9 +111,9 @@ class DeleteOne(object):
|
||||
class DeleteMany(object):
|
||||
"""Represents a delete_many operation."""
|
||||
|
||||
__slots__ = ("_filter", "_collation")
|
||||
__slots__ = ("_filter", "_collation", "_hint")
|
||||
|
||||
def __init__(self, filter, collation=None):
|
||||
def __init__(self, filter, collation=None, hint=None):
|
||||
"""Create a DeleteMany instance.
|
||||
|
||||
For use with :meth:`~pymongo.collection.Collection.bulk_write`.
|
||||
@ -110,18 +123,31 @@ class DeleteMany(object):
|
||||
- `collation` (optional): An instance of
|
||||
:class:`~pymongo.collation.Collation`. This option is only
|
||||
supported on MongoDB 3.4 and above.
|
||||
- `hint` (optional): An index to use to support the query
|
||||
predicate specified either by its string name, or in the same
|
||||
format as passed to
|
||||
:meth:`~pymongo.collection.Collection.create_index` (e.g.
|
||||
``[('field', ASCENDING)]``). This option is only supported on
|
||||
MongoDB 4.4 and above.
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
Added the ``hint`` option.
|
||||
.. versionchanged:: 3.5
|
||||
Added the `collation` option.
|
||||
"""
|
||||
if filter is not None:
|
||||
validate_is_mapping("filter", filter)
|
||||
if hint is not None:
|
||||
if not isinstance(hint, string_type):
|
||||
hint = helpers._index_document(hint)
|
||||
self._filter = filter
|
||||
self._collation = collation
|
||||
self._hint = hint
|
||||
|
||||
def _add_to_bulk(self, bulkobj):
|
||||
"""Add this operation to the _Bulk instance `bulkobj`."""
|
||||
bulkobj.add_delete(self._filter, 0, collation=self._collation)
|
||||
bulkobj.add_delete(self._filter, 0, collation=self._collation,
|
||||
hint=self._hint)
|
||||
|
||||
def __repr__(self):
|
||||
return "DeleteMany(%r, %r)" % (self._filter, self._collation)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.2.0"
|
||||
"minServerVersion": "4.1.11"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
"database_name": "crud-tests",
|
||||
"tests": [
|
||||
{
|
||||
"description": "BulkWrite with arrayFilters",
|
||||
"description": "BulkWrite updateOne with arrayFilters",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
@ -53,7 +53,86 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 0,
|
||||
"insertedCount": 0,
|
||||
"insertedIds": {},
|
||||
"matchedCount": 1,
|
||||
"modifiedCount": 1,
|
||||
"upsertedCount": 0,
|
||||
"upsertedIds": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {},
|
||||
"u": {
|
||||
"$set": {
|
||||
"y.$[i].b": 2
|
||||
}
|
||||
},
|
||||
"arrayFilters": [
|
||||
{
|
||||
"i.b": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
},
|
||||
"command_name": "update",
|
||||
"database_name": "crud-tests"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"y": [
|
||||
{
|
||||
"b": 2
|
||||
},
|
||||
{
|
||||
"b": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"y": [
|
||||
{
|
||||
"b": 0
|
||||
},
|
||||
{
|
||||
"b": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite updateMany with arrayFilters",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
@ -79,8 +158,8 @@
|
||||
"deletedCount": 0,
|
||||
"insertedCount": 0,
|
||||
"insertedIds": {},
|
||||
"matchedCount": 3,
|
||||
"modifiedCount": 3,
|
||||
"matchedCount": 2,
|
||||
"modifiedCount": 2,
|
||||
"upsertedCount": 0,
|
||||
"upsertedIds": {}
|
||||
}
|
||||
@ -92,19 +171,6 @@
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {},
|
||||
"u": {
|
||||
"$set": {
|
||||
"y.$[i].b": 2
|
||||
}
|
||||
},
|
||||
"arrayFilters": [
|
||||
{
|
||||
"i.b": 3
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"q": {},
|
||||
"u": {
|
||||
@ -134,7 +200,7 @@
|
||||
"_id": 1,
|
||||
"y": [
|
||||
{
|
||||
"b": 2
|
||||
"b": 3
|
||||
},
|
||||
{
|
||||
"b": 2
|
||||
|
||||
150
test/crud/v2/bulkWrite-delete-hint-clientError.json
Normal file
150
test/crud/v2/bulkWrite-delete-hint-clientError.json
Normal file
@ -0,0 +1,150 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "3.3.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
],
|
||||
"collection_name": "BulkWrite_delete_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "BulkWrite deleteOne with hints unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 2
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite deleteMany with hints unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gte": 4
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
209
test/crud/v2/bulkWrite-delete-hint-serverError.json
Normal file
209
test/crud/v2/bulkWrite-delete-hint-serverError.json
Normal file
@ -0,0 +1,209 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.3.3"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
],
|
||||
"collection_name": "BulkWrite_delete_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "BulkWrite deleteOne with hints unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 2
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "BulkWrite_delete_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 1
|
||||
},
|
||||
{
|
||||
"q": {
|
||||
"_id": 2
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 1
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite deleteMany with hints unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gte": 4
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "BulkWrite_delete_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 0
|
||||
},
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gte": 4
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 0
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
204
test/crud/v2/bulkWrite-delete-hint.json
Normal file
204
test/crud/v2/bulkWrite-delete-hint.json
Normal file
@ -0,0 +1,204 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.3.4"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
],
|
||||
"collection_name": "BulkWrite_delete_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "BulkWrite deleteOne with hints",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 2
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 2,
|
||||
"insertedCount": 0,
|
||||
"insertedIds": {},
|
||||
"matchedCount": 0,
|
||||
"modifiedCount": 0,
|
||||
"upsertedCount": 0,
|
||||
"upsertedIds": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "BulkWrite_delete_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 1
|
||||
},
|
||||
{
|
||||
"q": {
|
||||
"_id": 2
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 1
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite deleteMany with hints",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gte": 4
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 3,
|
||||
"insertedCount": 0,
|
||||
"insertedIds": {},
|
||||
"matchedCount": 0,
|
||||
"modifiedCount": 0,
|
||||
"upsertedCount": 0,
|
||||
"upsertedIds": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "BulkWrite_delete_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 0
|
||||
},
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gte": 4
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 0
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
235
test/crud/v2/bulkWrite-update-hint-clientError.json
Normal file
235
test/crud/v2/bulkWrite-update-hint-clientError.json
Normal file
@ -0,0 +1,235 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "3.3.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
],
|
||||
"collection_name": "test_bulkwrite_update_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "BulkWrite updateOne with update hints unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite updateMany with update hints unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite replaceOne with update hints unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "replaceOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 3
|
||||
},
|
||||
"replacement": {
|
||||
"x": 333
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "replaceOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 4
|
||||
},
|
||||
"replacement": {
|
||||
"x": 444
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
343
test/crud/v2/bulkWrite-update-hint-serverError.json
Normal file
343
test/crud/v2/bulkWrite-update-hint-serverError.json
Normal file
@ -0,0 +1,343 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.1.9"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
],
|
||||
"collection_name": "test_bulkwrite_update_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "BulkWrite updateOne with update hints unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test_bulkwrite_update_hint",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite updateMany with update hints unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test_bulkwrite_update_hint",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"multi": true,
|
||||
"hint": "_id_"
|
||||
},
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$lt": 3
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"multi": true,
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "BulkWrite replaceOne with update hints unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "replaceOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 3
|
||||
},
|
||||
"replacement": {
|
||||
"x": 333
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "replaceOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 4
|
||||
},
|
||||
"replacement": {
|
||||
"x": 444
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"ordered": true
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test_bulkwrite_update_hint",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 3
|
||||
},
|
||||
"u": {
|
||||
"x": 333
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
{
|
||||
"q": {
|
||||
"_id": 4
|
||||
},
|
||||
"u": {
|
||||
"x": 444
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"ordered": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
},
|
||||
{
|
||||
"_id": 4,
|
||||
"x": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
100
test/crud/v2/deleteMany-hint-clientError.json
Normal file
100
test/crud/v2/deleteMany-hint-clientError.json
Normal file
@ -0,0 +1,100 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "3.3.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
],
|
||||
"collection_name": "DeleteMany_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "DeleteMany with hint string unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "DeleteMany with hint document unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
141
test/crud/v2/deleteMany-hint-serverError.json
Normal file
141
test/crud/v2/deleteMany-hint-serverError.json
Normal file
@ -0,0 +1,141 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.3.3"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
],
|
||||
"collection_name": "DeleteMany_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "DeleteMany with hint string unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteMany_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "DeleteMany with hint document unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteMany_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
128
test/crud/v2/deleteMany-hint.json
Normal file
128
test/crud/v2/deleteMany-hint.json
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.3.4"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
],
|
||||
"collection_name": "DeleteMany_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "DeleteMany with hint string",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteMany_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "DeleteMany with hint document",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteMany_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
84
test/crud/v2/deleteOne-hint-clientError.json
Normal file
84
test/crud/v2/deleteOne-hint-clientError.json
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "3.3.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "DeleteOne_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "DeleteOne with hint string unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "DeleteOne with hint document unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
121
test/crud/v2/deleteOne-hint-serverError.json
Normal file
121
test/crud/v2/deleteOne-hint-serverError.json
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.3.3"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "DeleteOne_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "DeleteOne with hint string unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteOne_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "DeleteOne with hint document unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteOne_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
116
test/crud/v2/deleteOne-hint.json
Normal file
116
test/crud/v2/deleteOne-hint.json
Normal file
@ -0,0 +1,116 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.3.4"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "DeleteOne_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "DeleteOne with hint string",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteOne_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_",
|
||||
"limit": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "deleteOne with hint document",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "deleteOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"deletedCount": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"delete": "DeleteOne_hint",
|
||||
"deletes": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"limit": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
84
test/crud/v2/findOneAndDelete-hint-clientError.json
Normal file
84
test/crud/v2/findOneAndDelete-hint-clientError.json
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "4.0.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "findOneAndDelete_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndDelete with hint string unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndDelete",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndDelete with hint document",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndDelete",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
113
test/crud/v2/findOneAndDelete-hint-serverError.json
Normal file
113
test/crud/v2/findOneAndDelete-hint-serverError.json
Normal file
@ -0,0 +1,113 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.2.0",
|
||||
"maxServerVersion": "4.3.3"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "findOneAndDelete_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndDelete with hint string unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndDelete",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndDelete_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_",
|
||||
"remove": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndDelete with hint document",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndDelete",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndDelete_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"remove": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
110
test/crud/v2/findOneAndDelete-hint.json
Normal file
110
test/crud/v2/findOneAndDelete-hint.json
Normal file
@ -0,0 +1,110 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.3.4"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "findOneAndDelete_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndDelete with hint string",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndDelete",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"result": {
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndDelete_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": "_id_",
|
||||
"remove": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndDelete with hint document",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndDelete",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndDelete_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
},
|
||||
"remove": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
90
test/crud/v2/findOneAndReplace-hint-clientError.json
Normal file
90
test/crud/v2/findOneAndReplace-hint-clientError.json
Normal file
@ -0,0 +1,90 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "4.0.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "findOneAndReplace_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndReplace with hint string unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndReplace",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"replacement": {
|
||||
"x": 33
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndReplace with hint document unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndReplace",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"replacement": {
|
||||
"x": 33
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
123
test/crud/v2/findOneAndReplace-hint-serverError.json
Normal file
123
test/crud/v2/findOneAndReplace-hint-serverError.json
Normal file
@ -0,0 +1,123 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.2.0",
|
||||
"maxServerVersion": "4.3.0"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "findOneAndReplace_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndReplace with hint string unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndReplace",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"replacement": {
|
||||
"x": 33
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndReplace_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"x": 33
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndReplace with hint document unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndReplace",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"replacement": {
|
||||
"x": 33
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndReplace_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"x": 33
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
94
test/crud/v2/findOneAndUpdate-hint-clientError.json
Normal file
94
test/crud/v2/findOneAndUpdate-hint-clientError.json
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "4.0.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "findOneAndUpdate_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndUpdate with hint string unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndUpdate",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndUpdate with hint document unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndUpdate",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
131
test/crud/v2/findOneAndUpdate-hint-serverError.json
Normal file
131
test/crud/v2/findOneAndUpdate-hint-serverError.json
Normal file
@ -0,0 +1,131 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "4.2.0",
|
||||
"maxServerVersion": "4.3.0"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "findOneAndUpdate_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndUpdate with hint string unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndUpdate",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndUpdate_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndUpdate with hint document unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "findOneAndUpdate",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"findAndModify": "findOneAndUpdate_hint",
|
||||
"query": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
110
test/crud/v2/updateMany-hint-clientError.json
Normal file
110
test/crud/v2/updateMany-hint-clientError.json
Normal file
@ -0,0 +1,110 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "3.3.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
],
|
||||
"collection_name": "test_updatemany_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateMany with hint string unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "UpdateMany with hint document unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
161
test/crud/v2/updateMany-hint-serverError.json
Normal file
161
test/crud/v2/updateMany-hint-serverError.json
Normal file
@ -0,0 +1,161 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.1.9"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
],
|
||||
"collection_name": "test_updatemany_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateMany with hint string unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test_updatemany_hint",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"multi": true,
|
||||
"hint": "_id_"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "UpdateMany with hint document unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test_updatemany_hint",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"multi": true,
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
},
|
||||
{
|
||||
"_id": 3,
|
||||
"x": 33
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
98
test/crud/v2/updateOne-hint-clientError.json
Normal file
98
test/crud/v2/updateOne-hint-clientError.json
Normal file
@ -0,0 +1,98 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"maxServerVersion": "3.3.99"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "test_updateone_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateOne with hint string unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "UpdateOne with hint document unsupported (client-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
147
test/crud/v2/updateOne-hint-serverError.json
Normal file
147
test/crud/v2/updateOne-hint-serverError.json
Normal file
@ -0,0 +1,147 @@
|
||||
{
|
||||
"runOn": [
|
||||
{
|
||||
"minServerVersion": "3.4.0",
|
||||
"maxServerVersion": "4.1.9"
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
],
|
||||
"collection_name": "test_updateone_hint",
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateOne with hint string unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test_updateone_hint",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": "_id_"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "UpdateOne with hint document unsupported (server-side error)",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection",
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"update": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
},
|
||||
"error": true
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test_updateone_hint",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": {
|
||||
"$gt": 1
|
||||
}
|
||||
},
|
||||
"u": {
|
||||
"$inc": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
"hint": {
|
||||
"_id": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 11
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 22
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -238,6 +238,171 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "UpdateOne in bulk write using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"matchedCount": 1,
|
||||
"modifiedCount": 1,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"u": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"command_name": "update",
|
||||
"database_name": "crud-tests"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"u": {
|
||||
"v": 1
|
||||
},
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "UpdateMany in bulk write using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"result": {
|
||||
"matchedCount": 2,
|
||||
"modifiedCount": 2,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectations": [
|
||||
{
|
||||
"command_started_event": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {},
|
||||
"u": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"command_name": "update",
|
||||
"database_name": "crud-tests"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outcome": {
|
||||
"collection": {
|
||||
"data": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"foo": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -518,6 +518,10 @@ class SpecRunner(IntegrationTest):
|
||||
sessions = {}
|
||||
session_ids = {}
|
||||
for i in range(2):
|
||||
# Don't attempt to create sessions if they are not supported by
|
||||
# the running server version.
|
||||
if not client_context.sessions_enabled:
|
||||
break
|
||||
session_name = 'session%d' % i
|
||||
opts = camel_to_snake_args(test['sessionOptions'][session_name])
|
||||
if 'default_transaction_options' in opts:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user