...

Text file src/go.mongodb.org/mongo-driver/testdata/command-monitoring/deleteMany.json

Documentation: go.mongodb.org/mongo-driver/testdata/command-monitoring

     1{
     2  "description": "deleteMany",
     3  "schemaVersion": "1.0",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client",
     8        "observeEvents": [
     9          "commandStartedEvent",
    10          "commandSucceededEvent",
    11          "commandFailedEvent"
    12        ]
    13      }
    14    },
    15    {
    16      "database": {
    17        "id": "database",
    18        "client": "client",
    19        "databaseName": "command-monitoring-tests"
    20      }
    21    },
    22    {
    23      "collection": {
    24        "id": "collection",
    25        "database": "database",
    26        "collectionName": "test"
    27      }
    28    }
    29  ],
    30  "initialData": [
    31    {
    32      "collectionName": "test",
    33      "databaseName": "command-monitoring-tests",
    34      "documents": [
    35        {
    36          "_id": 1,
    37          "x": 11
    38        },
    39        {
    40          "_id": 2,
    41          "x": 22
    42        },
    43        {
    44          "_id": 3,
    45          "x": 33
    46        }
    47      ]
    48    }
    49  ],
    50  "tests": [
    51    {
    52      "description": "A successful deleteMany",
    53      "operations": [
    54        {
    55          "name": "deleteMany",
    56          "object": "collection",
    57          "arguments": {
    58            "filter": {
    59              "_id": {
    60                "$gt": 1
    61              }
    62            }
    63          }
    64        }
    65      ],
    66      "expectEvents": [
    67        {
    68          "client": "client",
    69          "events": [
    70            {
    71              "commandStartedEvent": {
    72                "command": {
    73                  "delete": "test",
    74                  "deletes": [
    75                    {
    76                      "q": {
    77                        "_id": {
    78                          "$gt": 1
    79                        }
    80                      },
    81                      "limit": 0
    82                    }
    83                  ],
    84                  "ordered": true
    85                },
    86                "commandName": "delete",
    87                "databaseName": "command-monitoring-tests"
    88              }
    89            },
    90            {
    91              "commandSucceededEvent": {
    92                "reply": {
    93                  "ok": 1,
    94                  "n": 2
    95                },
    96                "commandName": "delete"
    97              }
    98            }
    99          ]
   100        }
   101      ]
   102    },
   103    {
   104      "description": "A successful deleteMany with write errors",
   105      "operations": [
   106        {
   107          "name": "deleteMany",
   108          "object": "collection",
   109          "arguments": {
   110            "filter": {
   111              "_id": {
   112                "$unsupported": 1
   113              }
   114            }
   115          },
   116          "expectError": {
   117            "isClientError": false
   118          }
   119        }
   120      ],
   121      "expectEvents": [
   122        {
   123          "client": "client",
   124          "events": [
   125            {
   126              "commandStartedEvent": {
   127                "command": {
   128                  "delete": "test",
   129                  "deletes": [
   130                    {
   131                      "q": {
   132                        "_id": {
   133                          "$unsupported": 1
   134                        }
   135                      },
   136                      "limit": 0
   137                    }
   138                  ],
   139                  "ordered": true
   140                },
   141                "commandName": "delete",
   142                "databaseName": "command-monitoring-tests"
   143              }
   144            },
   145            {
   146              "commandSucceededEvent": {
   147                "reply": {
   148                  "ok": 1,
   149                  "n": 0,
   150                  "writeErrors": {
   151                    "$$type": "array"
   152                  }
   153                },
   154                "commandName": "delete"
   155              }
   156            }
   157          ]
   158        }
   159      ]
   160    }
   161  ]
   162}

View as plain text