...

Text file src/go.mongodb.org/mongo-driver/testdata/command-monitoring/logging/operation-id.json

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

     1{
     2  "description": "operation-id",
     3  "schemaVersion": "1.13",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client",
     8        "observeLogMessages": {
     9          "command": "debug"
    10        }
    11      }
    12    },
    13    {
    14      "database": {
    15        "id": "database",
    16        "client": "client",
    17        "databaseName": "logging-tests"
    18      }
    19    },
    20    {
    21      "collection": {
    22        "id": "collection",
    23        "database": "database",
    24        "collectionName": "logging-tests-collection"
    25      }
    26    }
    27  ],
    28  "initialData": [
    29    {
    30      "collectionName": "logging-tests-collection",
    31      "databaseName": "logging-tests",
    32      "documents": [
    33        {
    34          "_id": 1,
    35          "x": 11
    36        }
    37      ]
    38    }
    39  ],
    40  "tests": [
    41    {
    42      "description": "Successful bulk write command log messages include operationIds",
    43      "operations": [
    44        {
    45          "name": "bulkWrite",
    46          "object": "collection",
    47          "arguments": {
    48            "requests": [
    49              {
    50                "insertOne": {
    51                  "document": {
    52                    "x": 1
    53                  }
    54                }
    55              },
    56              {
    57                "deleteOne": {
    58                  "filter": {
    59                    "x": 1
    60                  }
    61                }
    62              }
    63            ]
    64          }
    65        }
    66      ],
    67      "expectLogMessages": [
    68        {
    69          "client": "client",
    70          "messages": [
    71            {
    72              "level": "debug",
    73              "component": "command",
    74              "data": {
    75                "message": "Command started",
    76                "databaseName": "logging-tests",
    77                "commandName": "insert",
    78                "operationId": {
    79                  "$$type": [
    80                    "int",
    81                    "long"
    82                  ]
    83                }
    84              }
    85            },
    86            {
    87              "level": "debug",
    88              "component": "command",
    89              "data": {
    90                "message": "Command succeeded",
    91                "commandName": "insert",
    92                "operationId": {
    93                  "$$type": [
    94                    "int",
    95                    "long"
    96                  ]
    97                }
    98              }
    99            },
   100            {
   101              "level": "debug",
   102              "component": "command",
   103              "data": {
   104                "message": "Command started",
   105                "databaseName": "logging-tests",
   106                "commandName": "delete",
   107                "operationId": {
   108                  "$$type": [
   109                    "int",
   110                    "long"
   111                  ]
   112                }
   113              }
   114            },
   115            {
   116              "level": "debug",
   117              "component": "command",
   118              "data": {
   119                "message": "Command succeeded",
   120                "commandName": "delete",
   121                "operationId": {
   122                  "$$type": [
   123                    "int",
   124                    "long"
   125                  ]
   126                }
   127              }
   128            }
   129          ]
   130        }
   131      ]
   132    },
   133    {
   134      "description": "Failed bulk write command log message includes operationId",
   135      "operations": [
   136        {
   137          "name": "bulkWrite",
   138          "object": "collection",
   139          "arguments": {
   140            "requests": [
   141              {
   142                "updateOne": {
   143                  "filter": {
   144                    "x": 1
   145                  },
   146                  "update": [
   147                    {
   148                      "$invalidOperator": true
   149                    }
   150                  ]
   151                }
   152              }
   153            ]
   154          },
   155          "expectError": {
   156            "isClientError": false
   157          }
   158        }
   159      ],
   160      "expectLogMessages": [
   161        {
   162          "client": "client",
   163          "messages": [
   164            {
   165              "level": "debug",
   166              "component": "command",
   167              "data": {
   168                "message": "Command started",
   169                "databaseName": "logging-tests",
   170                "commandName": "update",
   171                "operationId": {
   172                  "$$type": [
   173                    "int",
   174                    "long"
   175                  ]
   176                }
   177              }
   178            },
   179            {
   180              "level": "debug",
   181              "component": "command",
   182              "data": {
   183                "message": "Command failed",
   184                "commandName": "update",
   185                "operationId": {
   186                  "$$type": [
   187                    "int",
   188                    "long"
   189                  ]
   190                }
   191              }
   192            }
   193          ]
   194        }
   195      ]
   196    }
   197  ]
   198}

View as plain text