{
  "description": "read-concern",
  "schemaVersion": "1.3",
  "runOnRequirements": [
    {
      "minServerVersion": "4.0",
      "topologies": [
        "replicaset"
      ]
    },
    {
      "minServerVersion": "4.1.8",
      "topologies": [
        "sharded",
        "load-balanced"
      ]
    }
  ],
  "createEntities": [
    {
      "client": {
        "id": "client0",
        "useMultipleMongoses": false,
        "observeEvents": [
          "commandStartedEvent"
        ]
      }
    },
    {
      "database": {
        "id": "database0",
        "client": "client0",
        "databaseName": "transaction-tests"
      }
    },
    {
      "database": {
        "id": "database_rc_majority",
        "client": "client0",
        "databaseName": "transaction-tests",
        "databaseOptions": {
          "readConcern": {
            "level": "majority"
          }
        }
      }
    },
    {
      "collection": {
        "id": "collection_rc_majority",
        "database": "database0",
        "collectionName": "test",
        "collectionOptions": {
          "readConcern": {
            "level": "majority"
          }
        }
      }
    },
    {
      "session": {
        "id": "session0",
        "client": "client0"
      }
    }
  ],
  "initialData": [
    {
      "collectionName": "test",
      "databaseName": "transaction-tests",
      "documents": [
        {
          "_id": 1
        },
        {
          "_id": 2
        },
        {
          "_id": 3
        },
        {
          "_id": 4
        }
      ]
    }
  ],
  "tests": [
    {
      "description": "only first countDocuments includes readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction",
          "arguments": {
            "readConcern": {
              "level": "majority"
            }
          }
        },
        {
          "object": "collection_rc_majority",
          "name": "countDocuments",
          "arguments": {
            "filter": {
              "_id": {
                "$gte": 2
              }
            },
            "session": "session0"
          },
          "expectResult": 3
        },
        {
          "object": "collection_rc_majority",
          "name": "countDocuments",
          "arguments": {
            "filter": {
              "_id": {
                "$gte": 2
              }
            },
            "session": "session0"
          },
          "expectResult": 3
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$match": {
                        "_id": {
                          "$gte": 2
                        }
                      }
                    },
                    {
                      "$group": {
                        "_id": 1,
                        "n": {
                          "$sum": 1
                        }
                      }
                    }
                  ],
                  "cursor": {},
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "level": "majority"
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$match": {
                        "_id": {
                          "$gte": 2
                        }
                      }
                    },
                    {
                      "$group": {
                        "_id": 1,
                        "n": {
                          "$sum": 1
                        }
                      }
                    }
                  ],
                  "cursor": {},
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "only first find includes readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction",
          "arguments": {
            "readConcern": {
              "level": "majority"
            }
          }
        },
        {
          "object": "collection_rc_majority",
          "name": "find",
          "arguments": {
            "batchSize": 3,
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "collection_rc_majority",
          "name": "find",
          "arguments": {
            "batchSize": 3,
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "level": "majority"
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "only first aggregate includes readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction",
          "arguments": {
            "readConcern": {
              "level": "majority"
            }
          }
        },
        {
          "object": "collection_rc_majority",
          "name": "aggregate",
          "arguments": {
            "pipeline": [
              {
                "$project": {
                  "_id": 1
                }
              }
            ],
            "batchSize": 3,
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "collection_rc_majority",
          "name": "aggregate",
          "arguments": {
            "pipeline": [
              {
                "$project": {
                  "_id": 1
                }
              }
            ],
            "batchSize": 3,
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$project": {
                        "_id": 1
                      }
                    }
                  ],
                  "cursor": {
                    "batchSize": 3
                  },
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "level": "majority"
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$project": {
                        "_id": 1
                      }
                    }
                  ],
                  "cursor": {
                    "batchSize": 3
                  },
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "only first distinct includes readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction",
          "arguments": {
            "readConcern": {
              "level": "majority"
            }
          }
        },
        {
          "object": "collection_rc_majority",
          "name": "distinct",
          "arguments": {
            "fieldName": "_id",
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            1,
            2,
            3,
            4
          ]
        },
        {
          "object": "collection_rc_majority",
          "name": "distinct",
          "arguments": {
            "fieldName": "_id",
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            1,
            2,
            3,
            4
          ]
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "distinct": "test",
                  "key": "_id",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "level": "majority"
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "distinct",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "distinct": "test",
                  "key": "_id",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "distinct",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "only first runCommand includes readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction",
          "arguments": {
            "readConcern": {
              "level": "majority"
            }
          }
        },
        {
          "object": "database0",
          "name": "runCommand",
          "arguments": {
            "session": "session0",
            "command": {
              "find": "test"
            },
            "commandName": "find"
          }
        },
        {
          "object": "database0",
          "name": "runCommand",
          "arguments": {
            "session": "session0",
            "command": {
              "find": "test"
            },
            "commandName": "find"
          }
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "level": "majority"
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "countDocuments ignores collection readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction"
        },
        {
          "object": "collection_rc_majority",
          "name": "countDocuments",
          "arguments": {
            "filter": {
              "_id": {
                "$gte": 2
              }
            },
            "session": "session0"
          },
          "expectResult": 3
        },
        {
          "object": "collection_rc_majority",
          "name": "countDocuments",
          "arguments": {
            "filter": {
              "_id": {
                "$gte": 2
              }
            },
            "session": "session0"
          },
          "expectResult": 3
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$match": {
                        "_id": {
                          "$gte": 2
                        }
                      }
                    },
                    {
                      "$group": {
                        "_id": 1,
                        "n": {
                          "$sum": 1
                        }
                      }
                    }
                  ],
                  "cursor": {},
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$match": {
                        "_id": {
                          "$gte": 2
                        }
                      }
                    },
                    {
                      "$group": {
                        "_id": 1,
                        "n": {
                          "$sum": 1
                        }
                      }
                    }
                  ],
                  "cursor": {},
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "find ignores collection readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction"
        },
        {
          "object": "collection_rc_majority",
          "name": "find",
          "arguments": {
            "batchSize": 3,
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "collection_rc_majority",
          "name": "find",
          "arguments": {
            "batchSize": 3,
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "aggregate ignores collection readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction"
        },
        {
          "object": "collection_rc_majority",
          "name": "aggregate",
          "arguments": {
            "pipeline": [
              {
                "$project": {
                  "_id": 1
                }
              }
            ],
            "batchSize": 3,
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "collection_rc_majority",
          "name": "aggregate",
          "arguments": {
            "pipeline": [
              {
                "$project": {
                  "_id": 1
                }
              }
            ],
            "batchSize": 3,
            "session": "session0"
          },
          "expectResult": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$project": {
                        "_id": 1
                      }
                    }
                  ],
                  "cursor": {
                    "batchSize": 3
                  },
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "aggregate": "test",
                  "pipeline": [
                    {
                      "$project": {
                        "_id": 1
                      }
                    }
                  ],
                  "cursor": {
                    "batchSize": 3
                  },
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "aggregate",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "getMore": {
                    "$$type": [
                      "int",
                      "long"
                    ]
                  },
                  "collection": "test",
                  "batchSize": 3,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false
                },
                "commandName": "getMore",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "distinct ignores collection readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction"
        },
        {
          "object": "collection_rc_majority",
          "name": "distinct",
          "arguments": {
            "fieldName": "_id",
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            1,
            2,
            3,
            4
          ]
        },
        {
          "object": "collection_rc_majority",
          "name": "distinct",
          "arguments": {
            "fieldName": "_id",
            "filter": {},
            "session": "session0"
          },
          "expectResult": [
            1,
            2,
            3,
            4
          ]
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "distinct": "test",
                  "key": "_id",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "distinct",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "distinct": "test",
                  "key": "_id",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "distinct",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    },
    {
      "description": "runCommand ignores database readConcern",
      "operations": [
        {
          "object": "session0",
          "name": "startTransaction"
        },
        {
          "object": "database_rc_majority",
          "name": "runCommand",
          "arguments": {
            "session": "session0",
            "command": {
              "find": "test"
            },
            "commandName": "find"
          }
        },
        {
          "object": "database0",
          "name": "runCommand",
          "arguments": {
            "session": "session0",
            "command": {
              "find": "test"
            },
            "commandName": "find"
          }
        },
        {
          "object": "session0",
          "name": "commitTransaction"
        }
      ],
      "expectEvents": [
        {
          "client": "client0",
          "events": [
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": true,
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "find": "test",
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "find",
                "databaseName": "transaction-tests"
              }
            },
            {
              "commandStartedEvent": {
                "command": {
                  "commitTransaction": 1,
                  "lsid": {
                    "$$sessionLsid": "session0"
                  },
                  "readConcern": {
                    "$$exists": false
                  },
                  "txnNumber": {
                    "$numberLong": "1"
                  },
                  "startTransaction": {
                    "$$exists": false
                  },
                  "autocommit": false,
                  "writeConcern": {
                    "$$exists": false
                  }
                },
                "commandName": "commitTransaction",
                "databaseName": "admin"
              }
            }
          ]
        }
      ],
      "outcome": [
        {
          "collectionName": "test",
          "databaseName": "transaction-tests",
          "documents": [
            {
              "_id": 1
            },
            {
              "_id": 2
            },
            {
              "_id": 3
            },
            {
              "_id": 4
            }
          ]
        }
      ]
    }
  ]
}
