Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into oidc-workforce-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Nov 22, 2024
2 parents 28a047d + da04aff commit a4262f9
Show file tree
Hide file tree
Showing 37 changed files with 1,007 additions and 94 deletions.
2 changes: 1 addition & 1 deletion source/client-side-encryption/tests/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ due to the cost of calling between the native language and the C library.
A handle to libmongocrypt (`mongocrypt_t`) is needed for the benchmark. In the public driver API, `mongocrypt_t` is an
implementation detail contained in a `MongoClient`. The bindings API may more directly interface `mongocrypt_t`.
Example: the Java bindings API contains a
[MongoCrypt class](https://github.com/mongodb/libmongocrypt/blob/master/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCrypt.java)
[MongoCrypt class](https://github.com/mongodb/mongo-java-driver/blob/main/mongodb-crypt/src/main/com/mongodb/internal/crypt/capi/MongoCrypt.java)
closely wrapping the `mongocrypt_t`.

If possible, drivers are encouraged to use the bindings API and mock responses from the MongoDB server. This may help to
Expand Down
2 changes: 1 addition & 1 deletion source/logging/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ naively by simply truncating the output at the required length; i.e. do not atte
the output is still valid JSON. Truncated extended JSON MUST have a trailing ellipsis `...` appended to indicate to the
user that truncation occurred. The ellipsis MUST NOT count toward the max length.

> **Fallback Implementation method**: Environment variable `MONGOB_LOG_MAX_DOCUMENT_LENGTH`. When unspecified, any
> **Fallback Implementation method**: Environment variable `MONGODB_LOG_MAX_DOCUMENT_LENGTH`. When unspecified, any
> extended JSON representation of a document which is longer than the default max length MUST be truncated to that
> length. When set to an integer value, any extended JSON document longer than that value MUST be truncated to that
> length. If a variable is set to an invalid value, it MUST be treated as if it were not specified at all, and the
Expand Down
41 changes: 5 additions & 36 deletions source/retryable-writes/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,42 +63,9 @@ insert command (because all documents in the first command will be processed in
or delete that is split into two commands, the `skip` should be set to the number of statements in the first command to
allow the fail point to trigger on the second command.

## Command Construction Tests

Drivers should also assert that command documents are properly constructed with or without a transaction ID, depending
on whether the write operation is supported.
[Command Logging and Monitoring](../../command-logging-and-monitoring/command-logging-and-monitoring.md) may be used to
check for the presence of a `txnNumber` field in the command document. Note that command documents may always include an
`lsid` field per the [Driver Session](../../sessions/driver-sessions.md) specification.

These tests may be run against both a replica set and shard cluster.

Drivers should test that transaction IDs are never included in commands for unsupported write operations:

- Write commands with unacknowledged write concerns (e.g. `{w: 0}`)
- Unsupported single-statement write operations
- `updateMany()`
- `deleteMany()`
- Unsupported multi-statement write operations
- `bulkWrite()` that includes `UpdateMany` or `DeleteMany`
- Unsupported write commands
- `aggregate` with write stage (e.g. `$out`, `$merge`)

Drivers should test that transactions IDs are always included in commands for supported write operations:

- Supported single-statement write operations
- `insertOne()`
- `updateOne()`
- `replaceOne()`
- `deleteOne()`
- `findOneAndDelete()`
- `findOneAndReplace()`
- `findOneAndUpdate()`
- Supported multi-statement write operations
- `insertMany()` with `ordered=true`
- `insertMany()` with `ordered=false`
- `bulkWrite()` with `ordered=true` (no `UpdateMany` or `DeleteMany`)
- `bulkWrite()` with `ordered=false` (no `UpdateMany` or `DeleteMany`)
## ~~Command Construction Tests~~

The command construction prose tests have been removed in favor of command event assertions in the unified format tests.

## Prose Tests

Expand Down Expand Up @@ -297,6 +264,8 @@ debugger, code coverage tool, etc.

## Changelog

- 2024-10-29: Convert command construction tests to unified format.

- 2024-05-30: Migrated from reStructuredText to Markdown.

- 2024-02-27: Convert legacy retryable writes tests to unified format.
Expand Down
144 changes: 144 additions & 0 deletions source/retryable-writes/tests/unified/aggregate-out-merge.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions source/retryable-writes/tests/unified/aggregate-out-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
description: "aggregate with $out/$merge does not set txnNumber"

schemaVersion: "1.3"

runOnRequirements:
- minServerVersion: "3.6"
topologies:
- replicaset
- sharded
- load-balanced

createEntities:
- client:
id: &client0 client0
observeEvents: [ commandStartedEvent ]
- database:
id: &database0 database0
client: *client0
databaseName: &database0Name retryable-writes-tests
- collection:
id: &collection0 collection0
database: *database0
collectionName: &collection0Name coll0

initialData:
# The output collection must already exist for $merge on a sharded cluster
- collectionName: &mergeCollection mergeCollection
databaseName: *database0Name
documents: []

tests:
- description: "aggregate with $out does not set txnNumber"
operations:
- object: *collection0
name: aggregate
arguments:
pipeline:
- { $sort: { x: 1 } }
- { $match: { _id: { $gt: 1 } } }
- { $out: outCollection }
expectEvents:
- client: client0
events:
- commandStartedEvent:
commandName: aggregate
command:
txnNumber: { $$exists: false }
- description: "aggregate with $merge does not set txnNumber"
runOnRequirements:
- minServerVersion: "4.1.11"
operations:
- object: *collection0
name: aggregate
arguments:
pipeline:
- { $sort: { x: 1 } }
- { $match: { _id: { $gt: 1 } } }
- { $merge: { into: *mergeCollection } }
expectEvents:
- client: client0
events:
- commandStartedEvent:
commandName: aggregate
command:
txnNumber: { $$exists: false }
Loading

0 comments on commit a4262f9

Please sign in to comment.