...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/bulkWrite-insertOne-dots_and_dollars.json

Documentation: go.mongodb.org/mongo-driver/testdata/crud/unified

     1{
     2  "description": "bulkWrite-insertOne-dots_and_dollars",
     3  "schemaVersion": "1.0",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0",
     8        "observeEvents": [
     9          "commandStartedEvent"
    10        ]
    11      }
    12    },
    13    {
    14      "database": {
    15        "id": "database0",
    16        "client": "client0",
    17        "databaseName": "crud-tests"
    18      }
    19    },
    20    {
    21      "collection": {
    22        "id": "collection0",
    23        "database": "database0",
    24        "collectionName": "coll0"
    25      }
    26    }
    27  ],
    28  "initialData": [
    29    {
    30      "collectionName": "coll0",
    31      "databaseName": "crud-tests",
    32      "documents": []
    33    }
    34  ],
    35  "tests": [
    36    {
    37      "description": "Inserting document with top-level dollar-prefixed key on 5.0+ server",
    38      "runOnRequirements": [
    39        {
    40          "minServerVersion": "5.0"
    41        }
    42      ],
    43      "operations": [
    44        {
    45          "name": "bulkWrite",
    46          "object": "collection0",
    47          "arguments": {
    48            "requests": [
    49              {
    50                "insertOne": {
    51                  "document": {
    52                    "_id": 1,
    53                    "$a": 1
    54                  }
    55                }
    56              }
    57            ]
    58          },
    59          "expectResult": {
    60            "deletedCount": 0,
    61            "insertedCount": 1,
    62            "insertedIds": {
    63              "$$unsetOrMatches": {
    64                "0": 1
    65              }
    66            },
    67            "matchedCount": 0,
    68            "modifiedCount": 0,
    69            "upsertedCount": 0,
    70            "upsertedIds": {}
    71          }
    72        }
    73      ],
    74      "expectEvents": [
    75        {
    76          "client": "client0",
    77          "events": [
    78            {
    79              "commandStartedEvent": {
    80                "command": {
    81                  "insert": "coll0",
    82                  "documents": [
    83                    {
    84                      "_id": 1,
    85                      "$a": 1
    86                    }
    87                  ]
    88                }
    89              }
    90            }
    91          ]
    92        }
    93      ],
    94      "outcome": [
    95        {
    96          "collectionName": "coll0",
    97          "databaseName": "crud-tests",
    98          "documents": [
    99            {
   100              "_id": 1,
   101              "$a": 1
   102            }
   103          ]
   104        }
   105      ]
   106    },
   107    {
   108      "description": "Inserting document with top-level dollar-prefixed key on pre-5.0 server yields server-side error",
   109      "runOnRequirements": [
   110        {
   111          "maxServerVersion": "4.99"
   112        }
   113      ],
   114      "operations": [
   115        {
   116          "name": "bulkWrite",
   117          "object": "collection0",
   118          "arguments": {
   119            "requests": [
   120              {
   121                "insertOne": {
   122                  "document": {
   123                    "_id": 1,
   124                    "$a": 1
   125                  }
   126                }
   127              }
   128            ]
   129          },
   130          "expectError": {
   131            "isClientError": false
   132          }
   133        }
   134      ],
   135      "expectEvents": [
   136        {
   137          "client": "client0",
   138          "events": [
   139            {
   140              "commandStartedEvent": {
   141                "command": {
   142                  "insert": "coll0",
   143                  "documents": [
   144                    {
   145                      "_id": 1,
   146                      "$a": 1
   147                    }
   148                  ]
   149                }
   150              }
   151            }
   152          ]
   153        }
   154      ],
   155      "outcome": [
   156        {
   157          "collectionName": "coll0",
   158          "databaseName": "crud-tests",
   159          "documents": []
   160        }
   161      ]
   162    },
   163    {
   164      "description": "Inserting document with top-level dotted key",
   165      "operations": [
   166        {
   167          "name": "bulkWrite",
   168          "object": "collection0",
   169          "arguments": {
   170            "requests": [
   171              {
   172                "insertOne": {
   173                  "document": {
   174                    "_id": 1,
   175                    "a.b": 1
   176                  }
   177                }
   178              }
   179            ]
   180          },
   181          "expectResult": {
   182            "deletedCount": 0,
   183            "insertedCount": 1,
   184            "insertedIds": {
   185              "$$unsetOrMatches": {
   186                "0": 1
   187              }
   188            },
   189            "matchedCount": 0,
   190            "modifiedCount": 0,
   191            "upsertedCount": 0,
   192            "upsertedIds": {}
   193          }
   194        }
   195      ],
   196      "expectEvents": [
   197        {
   198          "client": "client0",
   199          "events": [
   200            {
   201              "commandStartedEvent": {
   202                "command": {
   203                  "insert": "coll0",
   204                  "documents": [
   205                    {
   206                      "_id": 1,
   207                      "a.b": 1
   208                    }
   209                  ]
   210                }
   211              }
   212            }
   213          ]
   214        }
   215      ],
   216      "outcome": [
   217        {
   218          "collectionName": "coll0",
   219          "databaseName": "crud-tests",
   220          "documents": [
   221            {
   222              "_id": 1,
   223              "a.b": 1
   224            }
   225          ]
   226        }
   227      ]
   228    },
   229    {
   230      "description": "Inserting document with dollar-prefixed key in embedded doc",
   231      "operations": [
   232        {
   233          "name": "bulkWrite",
   234          "object": "collection0",
   235          "arguments": {
   236            "requests": [
   237              {
   238                "insertOne": {
   239                  "document": {
   240                    "_id": 1,
   241                    "a": {
   242                      "$b": 1
   243                    }
   244                  }
   245                }
   246              }
   247            ]
   248          },
   249          "expectResult": {
   250            "deletedCount": 0,
   251            "insertedCount": 1,
   252            "insertedIds": {
   253              "$$unsetOrMatches": {
   254                "0": 1
   255              }
   256            },
   257            "matchedCount": 0,
   258            "modifiedCount": 0,
   259            "upsertedCount": 0,
   260            "upsertedIds": {}
   261          }
   262        }
   263      ],
   264      "expectEvents": [
   265        {
   266          "client": "client0",
   267          "events": [
   268            {
   269              "commandStartedEvent": {
   270                "command": {
   271                  "insert": "coll0",
   272                  "documents": [
   273                    {
   274                      "_id": 1,
   275                      "a": {
   276                        "$b": 1
   277                      }
   278                    }
   279                  ]
   280                }
   281              }
   282            }
   283          ]
   284        }
   285      ],
   286      "outcome": [
   287        {
   288          "collectionName": "coll0",
   289          "databaseName": "crud-tests",
   290          "documents": [
   291            {
   292              "_id": 1,
   293              "a": {
   294                "$b": 1
   295              }
   296            }
   297          ]
   298        }
   299      ]
   300    },
   301    {
   302      "description": "Inserting document with dotted key in embedded doc",
   303      "operations": [
   304        {
   305          "name": "bulkWrite",
   306          "object": "collection0",
   307          "arguments": {
   308            "requests": [
   309              {
   310                "insertOne": {
   311                  "document": {
   312                    "_id": 1,
   313                    "a": {
   314                      "b.c": 1
   315                    }
   316                  }
   317                }
   318              }
   319            ]
   320          },
   321          "expectResult": {
   322            "deletedCount": 0,
   323            "insertedCount": 1,
   324            "insertedIds": {
   325              "$$unsetOrMatches": {
   326                "0": 1
   327              }
   328            },
   329            "matchedCount": 0,
   330            "modifiedCount": 0,
   331            "upsertedCount": 0,
   332            "upsertedIds": {}
   333          }
   334        }
   335      ],
   336      "expectEvents": [
   337        {
   338          "client": "client0",
   339          "events": [
   340            {
   341              "commandStartedEvent": {
   342                "command": {
   343                  "insert": "coll0",
   344                  "documents": [
   345                    {
   346                      "_id": 1,
   347                      "a": {
   348                        "b.c": 1
   349                      }
   350                    }
   351                  ]
   352                }
   353              }
   354            }
   355          ]
   356        }
   357      ],
   358      "outcome": [
   359        {
   360          "collectionName": "coll0",
   361          "databaseName": "crud-tests",
   362          "documents": [
   363            {
   364              "_id": 1,
   365              "a": {
   366                "b.c": 1
   367              }
   368            }
   369          ]
   370        }
   371      ]
   372    }
   373  ]
   374}

View as plain text