...

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

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

     1{
     2  "description": "insertOne",
     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    }
    41  ],
    42  "tests": [
    43    {
    44      "description": "A successful insertOne",
    45      "operations": [
    46        {
    47          "name": "insertOne",
    48          "object": "collection",
    49          "arguments": {
    50            "document": {
    51              "_id": 2,
    52              "x": 22
    53            }
    54          }
    55        }
    56      ],
    57      "expectEvents": [
    58        {
    59          "client": "client",
    60          "events": [
    61            {
    62              "commandStartedEvent": {
    63                "command": {
    64                  "insert": "test",
    65                  "documents": [
    66                    {
    67                      "_id": 2,
    68                      "x": 22
    69                    }
    70                  ],
    71                  "ordered": true
    72                },
    73                "commandName": "insert",
    74                "databaseName": "command-monitoring-tests"
    75              }
    76            },
    77            {
    78              "commandSucceededEvent": {
    79                "reply": {
    80                  "ok": 1,
    81                  "n": 1
    82                },
    83                "commandName": "insert"
    84              }
    85            }
    86          ]
    87        }
    88      ]
    89    },
    90    {
    91      "description": "A successful insertOne with write errors",
    92      "operations": [
    93        {
    94          "name": "insertOne",
    95          "object": "collection",
    96          "arguments": {
    97            "document": {
    98              "_id": 1,
    99              "x": 11
   100            }
   101          },
   102          "expectError": {
   103            "isClientError": false
   104          }
   105        }
   106      ],
   107      "expectEvents": [
   108        {
   109          "client": "client",
   110          "events": [
   111            {
   112              "commandStartedEvent": {
   113                "command": {
   114                  "insert": "test",
   115                  "documents": [
   116                    {
   117                      "_id": 1,
   118                      "x": 11
   119                    }
   120                  ],
   121                  "ordered": true
   122                },
   123                "commandName": "insert",
   124                "databaseName": "command-monitoring-tests"
   125              }
   126            },
   127            {
   128              "commandSucceededEvent": {
   129                "reply": {
   130                  "ok": 1,
   131                  "n": 0,
   132                  "writeErrors": {
   133                    "$$type": "array"
   134                  }
   135                },
   136                "commandName": "insert"
   137              }
   138            }
   139          ]
   140        }
   141      ]
   142    }
   143  ]
   144}

View as plain text