PYTHON-1565 Add helpers and options for Change Streams Follow-on Work (#355) Add MongoClient.watch() and Database.watch(). Add start_at_operation_time to all watch() helpers.
446 lines
10 KiB
JSON
446 lines
10 KiB
JSON
{
|
|
"collection_name": "test",
|
|
"database_name": "change-stream-tests",
|
|
"collection2_name": "test2",
|
|
"database2_name": "change-stream-tests-2",
|
|
"tests": [
|
|
{
|
|
"description": "$changeStream must be the first stage in a change stream pipeline sent to the server",
|
|
"minServerVersion": "3.6.0",
|
|
"target": "collection",
|
|
"topology": [
|
|
"replicaset"
|
|
],
|
|
"changeStreamPipeline": [],
|
|
"changeStreamOptions": {},
|
|
"operations": [
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"x": 1
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"expectations": [
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"aggregate": "test",
|
|
"cursor": {},
|
|
"pipeline": [
|
|
{
|
|
"$changeStream": {
|
|
"fullDocument": "default"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"command_name": "aggregate",
|
|
"database_name": "change-stream-tests"
|
|
}
|
|
}
|
|
],
|
|
"result": {
|
|
"success": []
|
|
}
|
|
},
|
|
{
|
|
"description": "The server returns change stream responses in the specified server response format",
|
|
"minServerVersion": "3.6.0",
|
|
"target": "collection",
|
|
"topology": [
|
|
"replicaset"
|
|
],
|
|
"changeStreamPipeline": [],
|
|
"changeStreamOptions": {},
|
|
"operations": [
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"x": 1
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"expectations": [],
|
|
"result": {
|
|
"success": [
|
|
{
|
|
"_id": "42",
|
|
"documentKey": "42",
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests",
|
|
"coll": "test"
|
|
},
|
|
"fullDocument": {
|
|
"x": {
|
|
"$numberInt": "1"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "Executing a watch helper on a Collection results in notifications for changes to the specified collection",
|
|
"minServerVersion": "3.6.0",
|
|
"target": "collection",
|
|
"topology": [
|
|
"replicaset"
|
|
],
|
|
"changeStreamPipeline": [],
|
|
"changeStreamOptions": {},
|
|
"operations": [
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test2",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"x": 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"database": "change-stream-tests-2",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"y": 2
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"z": 3
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"expectations": [
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"aggregate": "test",
|
|
"cursor": {},
|
|
"pipeline": [
|
|
{
|
|
"$changeStream": {
|
|
"fullDocument": "default"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"command_name": "aggregate",
|
|
"database_name": "change-stream-tests"
|
|
}
|
|
}
|
|
],
|
|
"result": {
|
|
"success": [
|
|
{
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests",
|
|
"coll": "test"
|
|
},
|
|
"fullDocument": {
|
|
"z": {
|
|
"$numberInt": "3"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "Change Stream should allow valid aggregate pipeline stages",
|
|
"minServerVersion": "3.6.0",
|
|
"target": "collection",
|
|
"topology": [
|
|
"replicaset"
|
|
],
|
|
"changeStreamPipeline": [
|
|
{
|
|
"$match": {
|
|
"fullDocument.z": 3
|
|
}
|
|
}
|
|
],
|
|
"changeStreamOptions": {},
|
|
"operations": [
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"y": 2
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"z": 3
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"expectations": [
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"aggregate": "test",
|
|
"cursor": {},
|
|
"pipeline": [
|
|
{
|
|
"$changeStream": {
|
|
"fullDocument": "default"
|
|
}
|
|
},
|
|
{
|
|
"$match": {
|
|
"fullDocument.z": {
|
|
"$numberInt": "3"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"command_name": "aggregate",
|
|
"database_name": "change-stream-tests"
|
|
}
|
|
}
|
|
],
|
|
"result": {
|
|
"success": [
|
|
{
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests",
|
|
"coll": "test"
|
|
},
|
|
"fullDocument": {
|
|
"z": {
|
|
"$numberInt": "3"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "Executing a watch helper on a Database results in notifications for changes to all collections in the specified database.",
|
|
"minServerVersion": "3.8.0",
|
|
"target": "database",
|
|
"topology": [
|
|
"replicaset"
|
|
],
|
|
"changeStreamPipeline": [],
|
|
"changeStreamOptions": {},
|
|
"operations": [
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test2",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"x": 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"database": "change-stream-tests-2",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"y": 2
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"z": 3
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"expectations": [
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"aggregate": {
|
|
"$numberInt": "1"
|
|
},
|
|
"cursor": {},
|
|
"pipeline": [
|
|
{
|
|
"$changeStream": {
|
|
"fullDocument": "default"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"command_name": "aggregate",
|
|
"database_name": "change-stream-tests"
|
|
}
|
|
}
|
|
],
|
|
"result": {
|
|
"success": [
|
|
{
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests",
|
|
"coll": "test2"
|
|
},
|
|
"fullDocument": {
|
|
"x": {
|
|
"$numberInt": "1"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests",
|
|
"coll": "test"
|
|
},
|
|
"fullDocument": {
|
|
"z": {
|
|
"$numberInt": "3"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"description": "Executing a watch helper on a MongoClient results in notifications for changes to all collections in all databases in the cluster.",
|
|
"minServerVersion": "3.8.0",
|
|
"target": "client",
|
|
"topology": [
|
|
"replicaset"
|
|
],
|
|
"changeStreamPipeline": [],
|
|
"changeStreamOptions": {},
|
|
"operations": [
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test2",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"x": 1
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"database": "change-stream-tests-2",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"y": 2
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"database": "change-stream-tests",
|
|
"collection": "test",
|
|
"name": "insertOne",
|
|
"arguments": {
|
|
"document": {
|
|
"z": 3
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"expectations": [
|
|
{
|
|
"command_started_event": {
|
|
"command": {
|
|
"aggregate": {
|
|
"$numberInt": "1"
|
|
},
|
|
"cursor": {},
|
|
"pipeline": [
|
|
{
|
|
"$changeStream": {
|
|
"fullDocument": "default",
|
|
"allChangesForCluster": true
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"command_name": "aggregate",
|
|
"database_name": "admin"
|
|
}
|
|
}
|
|
],
|
|
"result": {
|
|
"success": [
|
|
{
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests",
|
|
"coll": "test2"
|
|
},
|
|
"fullDocument": {
|
|
"x": {
|
|
"$numberInt": "1"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests-2",
|
|
"coll": "test"
|
|
},
|
|
"fullDocument": {
|
|
"y": {
|
|
"$numberInt": "2"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"operationType": "insert",
|
|
"ns": {
|
|
"db": "change-stream-tests",
|
|
"coll": "test"
|
|
},
|
|
"fullDocument": {
|
|
"z": {
|
|
"$numberInt": "3"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|