...

Text file src/go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass/entity-find-cursor.json

Documentation: go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass

     1{
     2  "description": "entity-find-cursor",
     3  "schemaVersion": "1.3",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0",
     8        "observeEvents": [
     9          "commandStartedEvent",
    10          "commandSucceededEvent",
    11          "commandFailedEvent"
    12        ]
    13      }
    14    },
    15    {
    16      "database": {
    17        "id": "database0",
    18        "client": "client0",
    19        "databaseName": "database0Name"
    20      }
    21    },
    22    {
    23      "collection": {
    24        "id": "collection0",
    25        "database": "database0",
    26        "collectionName": "coll0"
    27      }
    28    }
    29  ],
    30  "initialData": [
    31    {
    32      "databaseName": "database0Name",
    33      "collectionName": "coll0",
    34      "documents": [
    35        {
    36          "_id": 1
    37        },
    38        {
    39          "_id": 2
    40        },
    41        {
    42          "_id": 3
    43        },
    44        {
    45          "_id": 4
    46        },
    47        {
    48          "_id": 5
    49        }
    50      ]
    51    }
    52  ],
    53  "tests": [
    54    {
    55      "description": "cursors can be created, iterated, and closed",
    56      "operations": [
    57        {
    58          "name": "createFindCursor",
    59          "object": "collection0",
    60          "arguments": {
    61            "filter": {},
    62            "batchSize": 2
    63          },
    64          "saveResultAsEntity": "cursor0"
    65        },
    66        {
    67          "name": "iterateUntilDocumentOrError",
    68          "object": "cursor0",
    69          "expectResult": {
    70            "_id": 1
    71          }
    72        },
    73        {
    74          "name": "iterateUntilDocumentOrError",
    75          "object": "cursor0",
    76          "expectResult": {
    77            "_id": 2
    78          }
    79        },
    80        {
    81          "name": "iterateUntilDocumentOrError",
    82          "object": "cursor0",
    83          "expectResult": {
    84            "_id": 3
    85          }
    86        },
    87        {
    88          "name": "close",
    89          "object": "cursor0"
    90        }
    91      ],
    92      "expectEvents": [
    93        {
    94          "client": "client0",
    95          "events": [
    96            {
    97              "commandStartedEvent": {
    98                "command": {
    99                  "find": "coll0",
   100                  "filter": {},
   101                  "batchSize": 2
   102                },
   103                "commandName": "find",
   104                "databaseName": "database0Name"
   105              }
   106            },
   107            {
   108              "commandSucceededEvent": {
   109                "reply": {
   110                  "cursor": {
   111                    "id": {
   112                      "$$type": "long"
   113                    },
   114                    "ns": {
   115                      "$$type": "string"
   116                    },
   117                    "firstBatch": {
   118                      "$$type": "array"
   119                    }
   120                  }
   121                },
   122                "commandName": "find"
   123              }
   124            },
   125            {
   126              "commandStartedEvent": {
   127                "command": {
   128                  "getMore": {
   129                    "$$type": "long"
   130                  },
   131                  "collection": "coll0"
   132                },
   133                "commandName": "getMore"
   134              }
   135            },
   136            {
   137              "commandSucceededEvent": {
   138                "reply": {
   139                  "cursor": {
   140                    "id": {
   141                      "$$type": "long"
   142                    },
   143                    "ns": {
   144                      "$$type": "string"
   145                    },
   146                    "nextBatch": {
   147                      "$$type": "array"
   148                    }
   149                  }
   150                },
   151                "commandName": "getMore"
   152              }
   153            },
   154            {
   155              "commandStartedEvent": {
   156                "command": {
   157                  "killCursors": "coll0",
   158                  "cursors": {
   159                    "$$type": "array"
   160                  }
   161                },
   162                "commandName": "killCursors"
   163              }
   164            },
   165            {
   166              "commandSucceededEvent": {
   167                "reply": {
   168                  "cursorsKilled": {
   169                    "$$unsetOrMatches": {
   170                      "$$type": "array"
   171                    }
   172                  }
   173                },
   174                "commandName": "killCursors"
   175              }
   176            }
   177          ]
   178        }
   179      ]
   180    }
   181  ]
   182}

View as plain text