...

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

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

     1{
     2  "description": "insertMany-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": "insertMany",
    46          "object": "collection0",
    47          "arguments": {
    48            "documents": [
    49              {
    50                "_id": 1,
    51                "$a": 1
    52              }
    53            ]
    54          },
    55          "expectResult": {
    56            "$$unsetOrMatches": {
    57              "insertedIds": {
    58                "$$unsetOrMatches": {
    59                  "0": 1
    60                }
    61              }
    62            }
    63          }
    64        }
    65      ],
    66      "expectEvents": [
    67        {
    68          "client": "client0",
    69          "events": [
    70            {
    71              "commandStartedEvent": {
    72                "command": {
    73                  "insert": "coll0",
    74                  "documents": [
    75                    {
    76                      "_id": 1,
    77                      "$a": 1
    78                    }
    79                  ]
    80                }
    81              }
    82            }
    83          ]
    84        }
    85      ],
    86      "outcome": [
    87        {
    88          "collectionName": "coll0",
    89          "databaseName": "crud-tests",
    90          "documents": [
    91            {
    92              "_id": 1,
    93              "$a": 1
    94            }
    95          ]
    96        }
    97      ]
    98    },
    99    {
   100      "description": "Inserting document with top-level dollar-prefixed key on pre-5.0 server yields server-side error",
   101      "runOnRequirements": [
   102        {
   103          "maxServerVersion": "4.99"
   104        }
   105      ],
   106      "operations": [
   107        {
   108          "name": "insertMany",
   109          "object": "collection0",
   110          "arguments": {
   111            "documents": [
   112              {
   113                "_id": 1,
   114                "$a": 1
   115              }
   116            ]
   117          },
   118          "expectError": {
   119            "isClientError": false
   120          }
   121        }
   122      ],
   123      "expectEvents": [
   124        {
   125          "client": "client0",
   126          "events": [
   127            {
   128              "commandStartedEvent": {
   129                "command": {
   130                  "insert": "coll0",
   131                  "documents": [
   132                    {
   133                      "_id": 1,
   134                      "$a": 1
   135                    }
   136                  ]
   137                }
   138              }
   139            }
   140          ]
   141        }
   142      ],
   143      "outcome": [
   144        {
   145          "collectionName": "coll0",
   146          "databaseName": "crud-tests",
   147          "documents": []
   148        }
   149      ]
   150    },
   151    {
   152      "description": "Inserting document with top-level dotted key",
   153      "operations": [
   154        {
   155          "name": "insertMany",
   156          "object": "collection0",
   157          "arguments": {
   158            "documents": [
   159              {
   160                "_id": 1,
   161                "a.b": 1
   162              }
   163            ]
   164          },
   165          "expectResult": {
   166            "$$unsetOrMatches": {
   167              "insertedIds": {
   168                "$$unsetOrMatches": {
   169                  "0": 1
   170                }
   171              }
   172            }
   173          }
   174        }
   175      ],
   176      "expectEvents": [
   177        {
   178          "client": "client0",
   179          "events": [
   180            {
   181              "commandStartedEvent": {
   182                "command": {
   183                  "insert": "coll0",
   184                  "documents": [
   185                    {
   186                      "_id": 1,
   187                      "a.b": 1
   188                    }
   189                  ]
   190                }
   191              }
   192            }
   193          ]
   194        }
   195      ],
   196      "outcome": [
   197        {
   198          "collectionName": "coll0",
   199          "databaseName": "crud-tests",
   200          "documents": [
   201            {
   202              "_id": 1,
   203              "a.b": 1
   204            }
   205          ]
   206        }
   207      ]
   208    },
   209    {
   210      "description": "Inserting document with dollar-prefixed key in embedded doc",
   211      "operations": [
   212        {
   213          "name": "insertMany",
   214          "object": "collection0",
   215          "arguments": {
   216            "documents": [
   217              {
   218                "_id": 1,
   219                "a": {
   220                  "$b": 1
   221                }
   222              }
   223            ]
   224          },
   225          "expectResult": {
   226            "$$unsetOrMatches": {
   227              "insertedIds": {
   228                "$$unsetOrMatches": {
   229                  "0": 1
   230                }
   231              }
   232            }
   233          }
   234        }
   235      ],
   236      "expectEvents": [
   237        {
   238          "client": "client0",
   239          "events": [
   240            {
   241              "commandStartedEvent": {
   242                "command": {
   243                  "insert": "coll0",
   244                  "documents": [
   245                    {
   246                      "_id": 1,
   247                      "a": {
   248                        "$b": 1
   249                      }
   250                    }
   251                  ]
   252                }
   253              }
   254            }
   255          ]
   256        }
   257      ],
   258      "outcome": [
   259        {
   260          "collectionName": "coll0",
   261          "databaseName": "crud-tests",
   262          "documents": [
   263            {
   264              "_id": 1,
   265              "a": {
   266                "$b": 1
   267              }
   268            }
   269          ]
   270        }
   271      ]
   272    },
   273    {
   274      "description": "Inserting document with dotted key in embedded doc",
   275      "operations": [
   276        {
   277          "name": "insertMany",
   278          "object": "collection0",
   279          "arguments": {
   280            "documents": [
   281              {
   282                "_id": 1,
   283                "a": {
   284                  "b.c": 1
   285                }
   286              }
   287            ]
   288          },
   289          "expectResult": {
   290            "$$unsetOrMatches": {
   291              "insertedIds": {
   292                "$$unsetOrMatches": {
   293                  "0": 1
   294                }
   295              }
   296            }
   297          }
   298        }
   299      ],
   300      "expectEvents": [
   301        {
   302          "client": "client0",
   303          "events": [
   304            {
   305              "commandStartedEvent": {
   306                "command": {
   307                  "insert": "coll0",
   308                  "documents": [
   309                    {
   310                      "_id": 1,
   311                      "a": {
   312                        "b.c": 1
   313                      }
   314                    }
   315                  ]
   316                }
   317              }
   318            }
   319          ]
   320        }
   321      ],
   322      "outcome": [
   323        {
   324          "collectionName": "coll0",
   325          "databaseName": "crud-tests",
   326          "documents": [
   327            {
   328              "_id": 1,
   329              "a": {
   330                "b.c": 1
   331              }
   332            }
   333          ]
   334        }
   335      ]
   336    }
   337  ]
   338}

View as plain text