...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/find-comment.json

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

     1{
     2  "description": "find-comment",
     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          "_id": 1,
    35          "x": 11
    36        },
    37        {
    38          "_id": 2,
    39          "x": 22
    40        },
    41        {
    42          "_id": 3,
    43          "x": 33
    44        },
    45        {
    46          "_id": 4,
    47          "x": 44
    48        },
    49        {
    50          "_id": 5,
    51          "x": 55
    52        },
    53        {
    54          "_id": 6,
    55          "x": 66
    56        }
    57      ]
    58    }
    59  ],
    60  "tests": [
    61    {
    62      "description": "find with string comment",
    63      "runOnRequirements": [
    64        {
    65          "minServerVersion": "3.6"
    66        }
    67      ],
    68      "operations": [
    69        {
    70          "name": "find",
    71          "object": "collection0",
    72          "arguments": {
    73            "filter": {
    74              "_id": 1
    75            },
    76            "comment": "comment"
    77          },
    78          "expectResult": [
    79            {
    80              "_id": 1
    81            }
    82          ]
    83        }
    84      ],
    85      "expectEvents": [
    86        {
    87          "client": "client0",
    88          "events": [
    89            {
    90              "commandStartedEvent": {
    91                "command": {
    92                  "find": "coll0",
    93                  "filter": {
    94                    "_id": 1
    95                  },
    96                  "comment": "comment"
    97                }
    98              }
    99            }
   100          ]
   101        }
   102      ]
   103    },
   104    {
   105      "description": "find with document comment",
   106      "runOnRequirements": [
   107        {
   108          "minServerVersion": "4.4"
   109        }
   110      ],
   111      "operations": [
   112        {
   113          "name": "find",
   114          "object": "collection0",
   115          "arguments": {
   116            "filter": {
   117              "_id": 1
   118            },
   119            "comment": {
   120              "key": "value"
   121            }
   122          },
   123          "expectResult": [
   124            {
   125              "_id": 1
   126            }
   127          ]
   128        }
   129      ],
   130      "expectEvents": [
   131        {
   132          "client": "client0",
   133          "events": [
   134            {
   135              "commandStartedEvent": {
   136                "command": {
   137                  "find": "coll0",
   138                  "filter": {
   139                    "_id": 1
   140                  },
   141                  "comment": {
   142                    "key": "value"
   143                  }
   144                }
   145              }
   146            }
   147          ]
   148        }
   149      ]
   150    },
   151    {
   152      "description": "find with document comment - pre 4.4",
   153      "skipReason": "TODO(GODRIVER-2386): aggregate only supports string comments",
   154      "runOnRequirements": [
   155        {
   156          "maxServerVersion": "4.2.99",
   157          "minServerVersion": "3.6"
   158        }
   159      ],
   160      "operations": [
   161        {
   162          "name": "find",
   163          "object": "collection0",
   164          "arguments": {
   165            "filter": {
   166              "_id": 1
   167            },
   168            "comment": {
   169              "key": "value"
   170            }
   171          },
   172          "expectError": {
   173            "isClientError": false
   174          }
   175        }
   176      ],
   177      "expectEvents": [
   178        {
   179          "client": "client0",
   180          "events": [
   181            {
   182              "commandStartedEvent": {
   183                "command": {
   184                  "find": "coll0",
   185                  "filter": {
   186                    "_id": 1
   187                  },
   188                  "comment": {
   189                    "key": "value"
   190                  }
   191                }
   192              }
   193            }
   194          ]
   195        }
   196      ]
   197    },
   198    {
   199      "description": "find with comment sets comment on getMore",
   200      "runOnRequirements": [
   201        {
   202          "minServerVersion": "4.4.0"
   203        }
   204      ],
   205      "operations": [
   206        {
   207          "name": "find",
   208          "object": "collection0",
   209          "arguments": {
   210            "filter": {
   211              "_id": {
   212                "$gt": 1
   213              }
   214            },
   215            "batchSize": 2,
   216            "comment": {
   217              "key": "value"
   218            }
   219          },
   220          "expectResult": [
   221            {
   222              "_id": 2,
   223              "x": 22
   224            },
   225            {
   226              "_id": 3,
   227              "x": 33
   228            },
   229            {
   230              "_id": 4,
   231              "x": 44
   232            },
   233            {
   234              "_id": 5,
   235              "x": 55
   236            },
   237            {
   238              "_id": 6,
   239              "x": 66
   240            }
   241          ]
   242        }
   243      ],
   244      "expectEvents": [
   245        {
   246          "client": "client0",
   247          "events": [
   248            {
   249              "commandStartedEvent": {
   250                "command": {
   251                  "find": "coll0",
   252                  "filter": {
   253                    "_id": {
   254                      "$gt": 1
   255                    }
   256                  },
   257                  "batchSize": 2,
   258                  "comment": {
   259                    "key": "value"
   260                  }
   261                }
   262              }
   263            },
   264            {
   265              "commandStartedEvent": {
   266                "command": {
   267                  "getMore": {
   268                    "$$type": [
   269                      "int",
   270                      "long"
   271                    ]
   272                  },
   273                  "collection": "coll0",
   274                  "batchSize": 2,
   275                  "comment": {
   276                    "key": "value"
   277                  }
   278                }
   279              }
   280            },
   281            {
   282              "commandStartedEvent": {
   283                "command": {
   284                  "getMore": {
   285                    "$$type": [
   286                      "int",
   287                      "long"
   288                    ]
   289                  },
   290                  "collection": "coll0",
   291                  "batchSize": 2,
   292                  "comment": {
   293                    "key": "value"
   294                  }
   295                }
   296              }
   297            }
   298          ]
   299        }
   300      ]
   301    },
   302    {
   303      "description": "find with comment does not set comment on getMore - pre 4.4",
   304      "runOnRequirements": [
   305        {
   306          "minServerVersion": "3.6.0",
   307          "maxServerVersion": "4.3.99"
   308        }
   309      ],
   310      "operations": [
   311        {
   312          "name": "find",
   313          "object": "collection0",
   314          "arguments": {
   315            "filter": {
   316              "_id": {
   317                "$gt": 1
   318              }
   319            },
   320            "batchSize": 2,
   321            "comment": "comment"
   322          },
   323          "expectResult": [
   324            {
   325              "_id": 2,
   326              "x": 22
   327            },
   328            {
   329              "_id": 3,
   330              "x": 33
   331            },
   332            {
   333              "_id": 4,
   334              "x": 44
   335            },
   336            {
   337              "_id": 5,
   338              "x": 55
   339            },
   340            {
   341              "_id": 6,
   342              "x": 66
   343            }
   344          ]
   345        }
   346      ],
   347      "expectEvents": [
   348        {
   349          "client": "client0",
   350          "events": [
   351            {
   352              "commandStartedEvent": {
   353                "command": {
   354                  "find": "coll0",
   355                  "filter": {
   356                    "_id": {
   357                      "$gt": 1
   358                    }
   359                  },
   360                  "batchSize": 2,
   361                  "comment": "comment"
   362                }
   363              }
   364            },
   365            {
   366              "commandStartedEvent": {
   367                "command": {
   368                  "getMore": {
   369                    "$$type": [
   370                      "int",
   371                      "long"
   372                    ]
   373                  },
   374                  "collection": "coll0",
   375                  "batchSize": 2,
   376                  "comment": {
   377                    "$$exists": false
   378                  }
   379                }
   380              }
   381            },
   382            {
   383              "commandStartedEvent": {
   384                "command": {
   385                  "getMore": {
   386                    "$$type": [
   387                      "int",
   388                      "long"
   389                    ]
   390                  },
   391                  "collection": "coll0",
   392                  "batchSize": 2,
   393                  "comment": {
   394                    "$$exists": false
   395                  }
   396                }
   397              }
   398            }
   399          ]
   400        }
   401      ]
   402    }
   403  ]
   404}

View as plain text