Skip to content

CDRIVER-3895: Sync CRUD tests for dots/dollars #809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 283 additions & 0 deletions src/libmongoc/tests/json/crud/unified/aggregate-let.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
"database": "database0",
"collectionName": "coll0"
}
},
{
"collection": {
"id": "collection1",
"database": "database0",
"collectionName": "coll1"
}
}
],
"initialData": [
Expand All @@ -34,6 +41,11 @@
"_id": 1
}
]
},
{
"collectionName": "coll1",
"databaseName": "crud-tests",
"documents": []
}
],
"tests": [
Expand All @@ -44,6 +56,109 @@
"minServerVersion": "5.0"
}
],
"operations": [
{
"name": "aggregate",
"object": "collection0",
"arguments": {
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 0,
"x": "$$x",
"y": "$$y",
"rand": "$$rand"
}
}
],
"let": {
"id": 1,
"x": "foo",
"y": {
"$literal": "bar"
},
"rand": {
"$rand": {}
}
}
},
"expectResult": [
{
"x": "foo",
"y": "bar",
"rand": {
"$$type": "double"
}
}
]
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "coll0",
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 0,
"x": "$$x",
"y": "$$y",
"rand": "$$rand"
}
}
],
"let": {
"id": 1,
"x": "foo",
"y": {
"$literal": "bar"
},
"rand": {
"$rand": {}
}
}
}
}
}
]
}
]
},
{
"description": "Aggregate with let option and dollar-prefixed $literal value",
"runOnRequirements": [
{
"minServerVersion": "5.0",
"topologies": [
"single",
"replicaset"
]
}
],
"operations": [
{
"name": "aggregate",
Expand Down Expand Up @@ -190,6 +305,174 @@
]
}
]
},
{
"description": "Aggregate to collection with let option",
"runOnRequirements": [
{
"minServerVersion": "5.0"
}
],
"operations": [
{
"name": "aggregate",
"object": "collection0",
"arguments": {
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 1
}
},
{
"$out": "coll1"
}
],
"let": {
"id": 1
}
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "coll0",
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 1
}
},
{
"$out": "coll1"
}
],
"let": {
"id": 1
}
}
}
}
]
}
],
"outcome": [
{
"collectionName": "coll1",
"databaseName": "crud-tests",
"documents": [
{
"_id": 1
}
]
}
]
},
{
"description": "Aggregate to collection with let option unsupported (server-side error)",
"runOnRequirements": [
{
"minServerVersion": "2.6.0",
"maxServerVersion": "4.4.99"
}
],
"operations": [
{
"name": "aggregate",
"object": "collection0",
"arguments": {
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 1
}
},
{
"$out": "coll1"
}
],
"let": {
"id": 1
}
},
"expectError": {
"errorContains": "unrecognized field 'let'",
"isClientError": false
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"aggregate": "coll0",
"pipeline": [
{
"$match": {
"$expr": {
"$eq": [
"$_id",
"$$id"
]
}
}
},
{
"$project": {
"_id": 1
}
},
{
"$out": "coll1"
}
],
"let": {
"id": 1
}
}
}
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
}
},
"expectResult": {
"insertedCount": 1,
"insertedId": {
"$$unsetOrMatches": 1
}
Expand Down Expand Up @@ -166,7 +165,6 @@
}
},
"expectResult": {
"insertedCount": 1,
"insertedId": {
"$$unsetOrMatches": 1
}
Expand Down Expand Up @@ -221,7 +219,6 @@
}
},
"expectResult": {
"insertedCount": 1,
"insertedId": {
"$$unsetOrMatches": 1
}
Expand Down Expand Up @@ -280,7 +277,6 @@
}
},
"expectResult": {
"insertedCount": 1,
"insertedId": {
"$$unsetOrMatches": 1
}
Expand Down Expand Up @@ -390,7 +386,6 @@
}
},
"expectResult": {
"insertedCount": 1,
"insertedId": {
"$$unsetOrMatches": {
"a.b": 1
Expand Down Expand Up @@ -501,7 +496,6 @@
}
},
"expectResult": {
"insertedCount": 1,
"insertedId": {
"$$unsetOrMatches": 1
}
Expand Down