{
  "collection_name": "test",
  "database_name": "change-stream-tests",
  "tests": [
    {
      "description": "change stream resumes after HostUnreachable",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 6,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after HostNotFound",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 7,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after NetworkTimeout",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 89,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after ShutdownInProgress",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 91,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after PrimarySteppedDown",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 189,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after ExceededTimeLimit",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 262,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after SocketException",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 9001,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after NotMaster",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 10107,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after InterruptedAtShutdown",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 11600,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after InterruptedDueToReplStateChange",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 11602,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after NotMasterNoSlaveOk",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 13435,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after NotMasterOrSecondary",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 13436,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after StaleShardVersion",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 63,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after StaleEpoch",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 150,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after RetryChangeStream",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 234,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes after FailedToSatisfyReadPreference",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failGetMoreAfterCursorCheckout",
        "mode": {
          "times": 1
        },
        "data": {
          "errorCode": 133,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream resumes if error contains ResumableChangeStreamError",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "getMore"
          ],
          "errorCode": 50,
          "closeConnection": false,
          "errorLabels": [
            "ResumableChangeStreamError"
          ]
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "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": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "getMore": 42,
              "collection": "test"
            },
            "command_name": "getMore",
            "database_name": "change-stream-tests"
          }
        },
        {
          "command_started_event": {
            "command": {
              "aggregate": "test",
              "cursor": {},
              "pipeline": [
                {
                  "$changeStream": {}
                }
              ]
            },
            "command_name": "aggregate",
            "database_name": "change-stream-tests"
          }
        }
      ],
      "result": {
        "success": [
          {
            "_id": "42",
            "documentKey": "42",
            "operationType": "insert",
            "ns": {
              "db": "change-stream-tests",
              "coll": "test"
            },
            "fullDocument": {
              "x": {
                "$numberInt": "1"
              }
            }
          }
        ]
      }
    },
    {
      "description": "change stream does not resume if error does not contain ResumableChangeStreamError",
      "minServerVersion": "4.3.1",
      "failPoint": {
        "configureFailPoint": "failCommand",
        "mode": {
          "times": 1
        },
        "data": {
          "failCommands": [
            "getMore"
          ],
          "errorCode": 6,
          "closeConnection": false
        }
      },
      "target": "collection",
      "topology": [
        "replicaset",
        "sharded"
      ],
      "changeStreamPipeline": [],
      "changeStreamOptions": {},
      "operations": [
        {
          "database": "change-stream-tests",
          "collection": "test",
          "name": "insertOne",
          "arguments": {
            "document": {
              "x": 1
            }
          }
        }
      ],
      "result": {
        "error": {
          "code": 6
        }
      }
    }
  ]
}
