Skip to content
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
31 changes: 30 additions & 1 deletion test/integration/crud/crud.spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@ const loadBalancedCollationTests = [
'Distinct with a collation'
];

const unimplementedCrudTests = {
'inserting _id with type null via clientBulkWrite':
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
'inserting _id with type null via insertOne':
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
'inserting _id with type null via insertMany':
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
'inserting _id with type null via bulkWrite':
'TODO(NODE-6468): Test that inserts and upserts respect null _id values (DRIVERS-2124)',
'partialResult is unset when all operations fail during an unordered bulk write':
'TODO(NODE-6384): do not set partialResult when using unacknowledged writes',
'partialResult is unset when first operation fails during an ordered bulk write (summary)':
'TODO(NODE-6384): do not set partialResult when using unacknowledged writes',
'partialResult is unset when first operation fails during an ordered bulk write (verbose)':
'TODO(NODE-6384): do not set partialResult when using unacknowledged writes',
'InsertMany passes bypassDocumentValidation: false':
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
'FindOneAndUpdate passes bypassDocumentValidation: false':
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
'FindOneAndReplace passes bypassDocumentValidation: false':
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
'BulkWrite passes bypassDocumentValidation: false':
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)',
'Aggregate with $out passes bypassDocumentValidation: false':
'TODO(NODE-6484): Allow drivers to set bypassDocumentValidation: false on write commands (DRIVERS-2865)'
};

describe('CRUD unified', function () {
runUnifiedSuite(
loadSpecTests(path.join('crud', 'unified')),
Expand All @@ -47,7 +74,9 @@ describe('CRUD unified', function () {
? `TODO(NODE-3541)`
: isLoadBalanced && loadBalancedCollationTests.includes(description)
? `TODO(NODE-6280): fix collation for find and modify commands on load balanced mode`
: false;
: description in unimplementedCrudTests
? unimplementedCrudTests[description]
: false;
}
);
});
148 changes: 148 additions & 0 deletions test/spec/crud/unified/bulkWrite-updateMany-pipeline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"description": "bulkWrite-updateMany-pipeline",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "4.1.11"
}
],
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "crud-tests"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "test"
}
}
],
"initialData": [
{
"collectionName": "test",
"databaseName": "crud-tests",
"documents": [
{
"_id": 1,
"x": 1,
"y": 1,
"t": {
"u": {
"v": 1
}
}
},
{
"_id": 2,
"x": 2,
"y": 1
}
]
}
],
"tests": [
{
"description": "UpdateMany in bulk write using pipelines",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"updateMany": {
"filter": {},
"update": [
{
"$project": {
"x": 1
}
},
{
"$addFields": {
"foo": 1
}
}
]
}
}
]
},
"expectResult": {
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"update": "test",
"updates": [
{
"q": {},
"u": [
{
"$project": {
"x": 1
}
},
{
"$addFields": {
"foo": 1
}
}
],
"multi": true,
"upsert": {
"$$unsetOrMatches": false
}
}
]
},
"commandName": "update",
"databaseName": "crud-tests"
}
}
]
}
],
"outcome": [
{
"collectionName": "test",
"databaseName": "crud-tests",
"documents": [
{
"_id": 1,
"x": 1,
"foo": 1
},
{
"_id": 2,
"x": 2,
"foo": 1
}
]
}
]
}
]
}
67 changes: 67 additions & 0 deletions test/spec/crud/unified/bulkWrite-updateMany-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
description: bulkWrite-updateMany-pipeline

schemaVersion: '1.0'

runOnRequirements:
- minServerVersion: 4.1.11

createEntities:
- client:
id: &client0 client0
observeEvents:
- commandStartedEvent
- database:
id: &database0 database0
client: client0
databaseName: &database_name crud-tests
- collection:
id: &collection0 collection0
database: database0
collectionName: &collection_name test

initialData:
- collectionName: *collection_name
databaseName: *database_name
documents:
- { _id: 1, x: 1, y: 1, t: { u: { v: 1 } } }
- { _id: 2, x: 2, y: 1 }

tests:
-
description: 'UpdateMany in bulk write using pipelines'
operations:
- object: *collection0
name: bulkWrite
arguments:
requests:
- updateMany:
filter: { }
update:
- { $project: { x: 1 } }
- { $addFields: { foo: 1 } }
expectResult:
matchedCount: 2
modifiedCount: 2
upsertedCount: 0
expectEvents:
- client: *client0
events:
- commandStartedEvent:
command:
update: *collection_name
updates:
- q: { }
u:
- { $project: { x: 1 } }
- { $addFields: { foo: 1 } }
multi: true
upsert: { $$unsetOrMatches: false }
commandName: update
databaseName: *database_name
outcome:
-
collectionName: *collection_name
databaseName: *database_name
documents:
- { _id: 1, x: 1, foo: 1 }
- { _id: 2, x: 2, foo: 1 }
Loading