PYTHON-5250 - Change streams expanded events present by default in 8.2+ (#2252)
This commit is contained in:
parent
7424f6c098
commit
e724d66bb5
@ -410,7 +410,14 @@ class APITestsMixin:
|
||||
expected_update_description = {"updatedFields": {"new": 1}, "removedFields": ["foo"]}
|
||||
if async_client_context.version.at_least(4, 5, 0):
|
||||
expected_update_description["truncatedArrays"] = []
|
||||
self.assertEqual(expected_update_description, change["updateDescription"])
|
||||
self.assertEqual(
|
||||
expected_update_description,
|
||||
{
|
||||
k: v
|
||||
for k, v in change["updateDescription"].items()
|
||||
if k in expected_update_description
|
||||
},
|
||||
)
|
||||
# Replace.
|
||||
await self.watched_collection().replace_one({"new": 1}, {"foo": "bar"})
|
||||
change = await change_stream.next()
|
||||
|
||||
@ -42,70 +42,6 @@
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "disambiguatedPaths is not present when showExpandedEvents is false/unset",
|
||||
"operations": [
|
||||
{
|
||||
"name": "insertOne",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"document": {
|
||||
"_id": 1,
|
||||
"a": {
|
||||
"1": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "createChangeStream",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"pipeline": []
|
||||
},
|
||||
"saveResultAsEntity": "changeStream0"
|
||||
},
|
||||
{
|
||||
"name": "updateOne",
|
||||
"object": "collection0",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": {
|
||||
"$set": {
|
||||
"a.1": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "iterateUntilDocumentOrError",
|
||||
"object": "changeStream0",
|
||||
"expectResult": {
|
||||
"operationType": "update",
|
||||
"ns": {
|
||||
"db": "database0",
|
||||
"coll": "collection0"
|
||||
},
|
||||
"updateDescription": {
|
||||
"updatedFields": {
|
||||
"$$exists": true
|
||||
},
|
||||
"removedFields": {
|
||||
"$$exists": true
|
||||
},
|
||||
"truncatedArrays": {
|
||||
"$$exists": true
|
||||
},
|
||||
"disambiguatedPaths": {
|
||||
"$$exists": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present",
|
||||
"operations": [
|
||||
|
||||
@ -181,7 +181,12 @@
|
||||
"field": "array",
|
||||
"newSize": 2
|
||||
}
|
||||
]
|
||||
],
|
||||
"disambiguatedPaths": {
|
||||
"$$unsetOrMatches": {
|
||||
"$$exists": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1408,6 +1413,11 @@
|
||||
"$$unsetOrMatches": {
|
||||
"$$exists": true
|
||||
}
|
||||
},
|
||||
"disambiguatedPaths": {
|
||||
"$$unsetOrMatches": {
|
||||
"$$exists": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,7 +406,14 @@ class APITestsMixin:
|
||||
expected_update_description = {"updatedFields": {"new": 1}, "removedFields": ["foo"]}
|
||||
if client_context.version.at_least(4, 5, 0):
|
||||
expected_update_description["truncatedArrays"] = []
|
||||
self.assertEqual(expected_update_description, change["updateDescription"])
|
||||
self.assertEqual(
|
||||
expected_update_description,
|
||||
{
|
||||
k: v
|
||||
for k, v in change["updateDescription"].items()
|
||||
if k in expected_update_description
|
||||
},
|
||||
)
|
||||
# Replace.
|
||||
self.watched_collection().replace_one({"new": 1}, {"foo": "bar"})
|
||||
change = change_stream.next()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user