From 4eba34decdfc82174f38fde96fc47d1a114609ff Mon Sep 17 00:00:00 2001 From: Rea Rustagi <85902999+rustagir@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:48:13 -0500 Subject: [PATCH] DOCSP-46391: client bulk write (#96) (cherry picked from commit c925426a23aa104ae949e46131f4d83a1d731ee5) --- snooty.toml | 2 + .../choose-connection-target.txt | 2 +- .../connect-to-mongo/connection-options.txt | 8 +- .../create-a-mongo-client.txt | 2 +- .../connect-to-mongo/network-compression.txt | 6 +- source/connect-to-mongo/stable-api.txt | 14 +- source/connect-to-mongo/tls.txt | 2 +- source/data-formats/time-series.txt | 12 +- source/includes/write/client-bulk-write.java | 114 +++++++ source/monitoring.txt | 26 +- source/read-write-configuration.txt | 16 +- source/read/change-streams.txt | 8 +- source/read/count-documents.txt | 6 +- source/read/cursors.txt | 6 +- source/read/distinct.txt | 6 +- source/read/retrieve-data.txt | 8 +- source/read/specify-a-query.txt | 4 +- source/read/specify-documents-to-return.txt | 10 +- source/read/specify-fields-return.txt | 4 +- source/security/encrypt.txt | 2 +- source/upgrade.txt | 6 +- source/whats-new.txt | 6 +- source/write/bulk-writes.txt | 292 ++++++++++++++++-- source/write/insert-documents.txt | 8 +- source/write/replace-documents.txt | 6 +- source/write/run-command.txt | 2 +- source/write/transactions.txt | 10 +- source/write/write-delete-documents.txt | 8 +- source/write/write-update-documents.txt | 12 +- 29 files changed, 485 insertions(+), 123 deletions(-) create mode 100644 source/includes/write/client-bulk-write.java diff --git a/snooty.toml b/snooty.toml index 1a8c0a3b..a2c48113 100644 --- a/snooty.toml +++ b/snooty.toml @@ -24,6 +24,8 @@ driver-long = "MongoDB Java Reactive Streams Driver" version = "5.3" full-version = "{+version+}.0" api = "https://mongodb.github.io/mongo-java-driver/{+version+}/apidocs" +rs-driver-api = "{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client" +core-api = "{+api+}/mongodb-driver-core/com/mongodb" rs-docs = "https://www.reactive-streams.org/reactive-streams-1.0.4-javadoc/org/reactivestreams" driver-source-gh = "https://github.com/mongodb/mongo-java-driver" java-rs = "Java Reactive Streams" diff --git a/source/connect-to-mongo/choose-connection-target.txt b/source/connect-to-mongo/choose-connection-target.txt index 3758a506..46f7d37c 100644 --- a/source/connect-to-mongo/choose-connection-target.txt +++ b/source/connect-to-mongo/choose-connection-target.txt @@ -142,4 +142,4 @@ API Documentation To learn more about creating a ``MongoClient`` instance in the {+driver-short+}, see the following API documentation: -- `MongoClient <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClients.html>`__ \ No newline at end of file +- `MongoClient <{+rs-driver-api+}/MongoClients.html>`__ \ No newline at end of file diff --git a/source/connect-to-mongo/connection-options.txt b/source/connect-to-mongo/connection-options.txt index 70ae8976..60452590 100644 --- a/source/connect-to-mongo/connection-options.txt +++ b/source/connect-to-mongo/connection-options.txt @@ -68,7 +68,7 @@ Authentication * - **authMechanism** - | Sets the mechanism the {+driver-short+} uses to authenticate the - | application. Valid options are defined in the `Class ConnectionString <{+api+}/mongodb-driver-core/com/mongodb/ConnectionString.html>`__ API documentation. + | application. Valid options are defined in the `Class ConnectionString <{+core-api+}/ConnectionString.html>`__ API documentation. | | **Data Type**: {+string-data-type+} | **Default**: ``"SCRAM-SHA-256"`` when connecting to MongoDB v4.0 or later. @@ -376,7 +376,7 @@ Read Preference Configuration | colon-separated key-value pairs, e.g. ``dc:ny,rack:1``. | Spaces are stripped from beginning and end of all keys and values. To | specify a list of tag sets, use multiple ``readPreferenceTags``, separated - | by semicolons. To learn more about ``readPreferenceTags``, see the `Class ConnectionString <{+api+}/mongodb-driver-core/com/mongodb/ConnectionString.html>`__ API documentation. + | by semicolons. To learn more about ``readPreferenceTags``, see the `Class ConnectionString <{+core-api+}/ConnectionString.html>`__ API documentation. | | **Data Type**: {+string-data-type+} | **Default**: ``null`` @@ -384,7 +384,7 @@ Read Preference Configuration * - **maxStalenessSeconds** - | Sets the maximum staleness in seconds. To learn more about staleness, - | see the `Class ConnectionString <{+api+}/mongodb-driver-core/com/mongodb/ConnectionString.html>`__ API documentation. + | see the `Class ConnectionString <{+core-api+}/ConnectionString.html>`__ API documentation. | | **Data Type**: ``Integer`` | **Default**: ``null`` @@ -471,7 +471,7 @@ SRV Configuration * - **srvServiceName** - | Sets the SRV service name. See - | the `ClusterSettings.getSrvServiceName() <{+api+}/mongodb-driver-core/com/mongodb/connection/ClusterSettings.html#getSrvServiceName()>`__ + | the `ClusterSettings.getSrvServiceName() <{+core-api+}/connection/ClusterSettings.html#getSrvServiceName()>`__ | API documentation to learn more. | | **Data Type**: {+string-data-type+} diff --git a/source/connect-to-mongo/create-a-mongo-client.txt b/source/connect-to-mongo/create-a-mongo-client.txt index 37c9a57f..61fed95e 100644 --- a/source/connect-to-mongo/create-a-mongo-client.txt +++ b/source/connect-to-mongo/create-a-mongo-client.txt @@ -117,4 +117,4 @@ API Documentation To learn more about creating a ``MongoClient`` instance in the {+driver-short+}, see the following API documentation: -- `MongoClient <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClients.html>`__ \ No newline at end of file +- `MongoClient <{+rs-driver-api+}/MongoClients.html>`__ \ No newline at end of file diff --git a/source/connect-to-mongo/network-compression.txt b/source/connect-to-mongo/network-compression.txt index 0bf9b325..ae93ecc3 100644 --- a/source/connect-to-mongo/network-compression.txt +++ b/source/connect-to-mongo/network-compression.txt @@ -92,7 +92,7 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoClient <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClient.html>`__ -- `createSnappyCompressor() <{+api+}/mongodb-driver-core/com/mongodb/MongoCompressor.html#createSnappyCompressor()>`__ +- `MongoClient <{+rs-driver-api+}/MongoClient.html>`__ +- `createSnappyCompressor() <{+core-api+}/MongoCompressor.html#createSnappyCompressor()>`__ - `createZlibCompressor() <{+api+}//mongodb-driver-core/com/mongodb/MongoCompressor.html#createZlibCompressor()>`__ -- `createZstdCompressor() <{+api+}/mongodb-driver-core/com/mongodb/MongoCompressor.html#createZstdCompressor()>`__ \ No newline at end of file +- `createZstdCompressor() <{+core-api+}/MongoCompressor.html#createZstdCompressor()>`__ \ No newline at end of file diff --git a/source/connect-to-mongo/stable-api.txt b/source/connect-to-mongo/stable-api.txt index eda7f268..2aee0d1e 100644 --- a/source/connect-to-mongo/stable-api.txt +++ b/source/connect-to-mongo/stable-api.txt @@ -122,10 +122,10 @@ API Documentation For more information about using the {+stable-api+} with the {+driver-short+}, see the following API documentation: -- `ServerApi <{+api+}/mongodb-driver-core/com/mongodb/ServerApi.html>`__ -- `ServerApi.Builder <{+api+}/mongodb-driver-core/com/mongodb/ServerApi.Builder.html>`__ -- `ServerApiVersion <{+api+}/mongodb-driver-core/com/mongodb/ServerApiVersion.html>`__ -- `ServerAddress <{+api+}/mongodb-driver-core/com/mongodb/ServerAddress.html>`__ -- `MongoClientSettings <{+api+}/mongodb-driver-core/com/mongodb/MongoClientSettings.html>`__ -- `MongoClientSettings.Builder <{+api+}/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html>`__ -- `MongoClients <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClients.html>`__ +- `ServerApi <{+core-api+}/ServerApi.html>`__ +- `ServerApi.Builder <{+core-api+}/ServerApi.Builder.html>`__ +- `ServerApiVersion <{+core-api+}/ServerApiVersion.html>`__ +- `ServerAddress <{+core-api+}/ServerAddress.html>`__ +- `MongoClientSettings <{+core-api+}/MongoClientSettings.html>`__ +- `MongoClientSettings.Builder <{+core-api+}/MongoClientSettings.Builder.html>`__ +- `MongoClients <{+rs-driver-api+}/MongoClients.html>`__ diff --git a/source/connect-to-mongo/tls.txt b/source/connect-to-mongo/tls.txt index 27ccbb42..fe4c62dd 100644 --- a/source/connect-to-mongo/tls.txt +++ b/source/connect-to-mongo/tls.txt @@ -111,7 +111,7 @@ Include the following import statements: To instruct the driver to use `io.netty.handler.ssl.SslContext `__, -configure `NettyTransportSettings <{+api+}/mongodb-driver-core/com/mongodb/connection/NettyTransportSettings.html>`__ +configure `NettyTransportSettings <{+core-api+}/connection/NettyTransportSettings.html>`__ when you define your ``MongoClientSettings``. Use ``MongoClientSettings.Builder.transportSettings()`` diff --git a/source/data-formats/time-series.txt b/source/data-formats/time-series.txt index 5ba8f68c..c503c3f8 100644 --- a/source/data-formats/time-series.txt +++ b/source/data-formats/time-series.txt @@ -69,8 +69,8 @@ To create a time series collection, pass the following parameters to the - The name of the new collection to create -- A `CreateCollectionOptions <{+api+}/mongodb-driver-core/com/mongodb/client/model/CreateCollectionOptions.html>`__ - object with the `TimeSeriesOptions <{+api+}/mongodb-driver-core/com/mongodb/client/model/TimeSeriesOptions.html>`__ set +- A `CreateCollectionOptions <{+core-api+}/client/model/CreateCollectionOptions.html>`__ + object with the `TimeSeriesOptions <{+core-api+}/client/model/TimeSeriesOptions.html>`__ set with the ``timeSeriesOptions()`` method .. _java-rs-time-series-create-example: @@ -165,7 +165,7 @@ API Documentation To learn more about the methods mentioned in this guide, see the following API documentation: -- `createCollection() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoDatabase.html#createCollection(java.lang.String)>`__ -- `listCollections() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoDatabase.html#listCollections()>`__ -- `insertOne() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#insertOne(TDocument)>`__ -- `insertMany() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#insertMany(java.util.List)>`__ \ No newline at end of file +- `createCollection() <{+rs-driver-api+}/MongoDatabase.html#createCollection(java.lang.String)>`__ +- `listCollections() <{+rs-driver-api+}/MongoDatabase.html#listCollections()>`__ +- `insertOne() <{+rs-driver-api+}/MongoCollection.html#insertOne(TDocument)>`__ +- `insertMany() <{+rs-driver-api+}/MongoCollection.html#insertMany(java.util.List)>`__ \ No newline at end of file diff --git a/source/includes/write/client-bulk-write.java b/source/includes/write/client-bulk-write.java new file mode 100644 index 00000000..947ddd53 --- /dev/null +++ b/source/includes/write/client-bulk-write.java @@ -0,0 +1,114 @@ +package org.example; + +import com.mongodb.*; +import com.mongodb.client.model.*; +import com.mongodb.client.model.bulk.*; +import org.bson.Document; + +import org.reactivestreams.Publisher; +import reactor.core.publisher.Mono; + +import com.mongodb.reactivestreams.client.MongoClient; +import com.mongodb.reactivestreams.client.MongoClients; + +import java.util.*; + +public class QuickStart { + public static void main(String[] args) { + // Replace the placeholder with your Atlas connection string + String uri = ""; + + MongoClientSettings settings = MongoClientSettings.builder() + .applyConnectionString(new ConnectionString(uri)) + .build(); + + // Create a new client and connect to the server + try (MongoClient mongoClient = MongoClients.create(settings)) { + + // start-insert-models + ClientNamespacedInsertOneModel personToInsert = ClientNamespacedWriteModel + .insertOne( + new MongoNamespace("db", "people"), + new Document("name", "Julia Smith") + ); + + ClientNamespacedInsertOneModel thingToInsert = ClientNamespacedWriteModel + .insertOne( + new MongoNamespace("db", "things"), + new Document("object", "washing machine") + ); + // end-insert-models + + // start-replace-models + ClientNamespacedReplaceOneModel personReplacement = ClientNamespacedWriteModel + .replaceOne( + new MongoNamespace("db", "people"), + Filters.eq("_id", 1), + new Document("name", "Frederic Hilbert") + ); + + ClientNamespacedReplaceOneModel thingReplacement = ClientNamespacedWriteModel + .replaceOne( + new MongoNamespace("db", "things"), + Filters.eq("_id", 1), + new Document("object", "potato") + ); + // end-replace-models + + // start-perform + MongoNamespace peopleNamespace = new MongoNamespace("db", "people"); + MongoNamespace thingsNamespace = new MongoNamespace("db", "things"); + + List bulkOperations = Arrays.asList( + ClientNamespacedWriteModel + .insertOne( + peopleNamespace, + new Document("name", "Corey Kopper") + ), + ClientNamespacedWriteModel + .replaceOne( + thingsNamespace, + Filters.eq("_id", 1), + new Document("object", "potato") + ) + ); + + Publisher bulkWritePublisher = mongoClient + .bulkWrite(bulkOperations); + + ClientBulkWriteResult clientBulkResult = Mono + .from(bulkWritePublisher) + .block(); + + System.out.println(clientBulkResult.toString()); + // end-perform + + // start-options + MongoNamespace namespace = new MongoNamespace("db", "people"); + + ClientBulkWriteOptions options = ClientBulkWriteOptions + .clientBulkWriteOptions() + .ordered(false); + + List bulkOperations = Arrays.asList( + ClientNamespacedWriteModel.insertOne( + namespace, + new Document("_id", 1).append("name", "Rudra Suraj") + ), + // Causes a duplicate key error + ClientNamespacedWriteModel.insertOne( + namespace, + new Document("_id", 1).append("name", "Mario Bianchi") + ), + ClientNamespacedWriteModel.insertOne( + namespace, + new Document("name", "Wendy Zhang") + ) + ); + + Publisher bulkWritePublisher = mongoClient + .bulkWrite(bulkOperations, options); + // end-options + } + } +} diff --git a/source/monitoring.txt b/source/monitoring.txt index 941f7b38..0be0e5ea 100644 --- a/source/monitoring.txt +++ b/source/monitoring.txt @@ -66,7 +66,7 @@ The MongoDB Java driver organizes the events it defines into three categories: The following sections show how to monitor each event category. For a full list of the events you can monitor, -`see the event package of the MongoDB Java Driver <{+api+}/mongodb-driver-core/com/mongodb/event/package-summary.html>`__. +`see the event package of the MongoDB Java Driver <{+core-api+}/event/package-summary.html>`__. .. _java-rs-command-events: @@ -380,7 +380,7 @@ Oracle: For more information about the ``JMXConnectionPoolListener`` class, see the API Documentation for -`JMXConnectionPoolListener <{+api+}/mongodb-driver-core/com/mongodb/management/JMXConnectionPoolListener.html>`__. +`JMXConnectionPoolListener <{+core-api+}/management/JMXConnectionPoolListener.html>`__. Include the Driver in Your Distributed Tracing System ----------------------------------------------------- @@ -418,14 +418,14 @@ API Documentation For more information about the classes and methods mentioned in this document, see the following API Documentation: -- `MongoClients <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClients.html>`__ -- `MongoClientSettings <{+api+}/mongodb-driver-core/com/mongodb/MongoClientSettings.html>`__ -- `CommandListener <{+api+}/mongodb-driver-core/com/mongodb/event/CommandListener.html>`__ -- `CommandStartedEvent <{+api+}/mongodb-driver-core/com/mongodb/event/CommandStartedEvent.html>`__ -- `CommandSucceededEvent <{+api+}/mongodb-driver-core/com/mongodb/event/CommandSucceededEvent.html>`__ -- `CommandFailedEvent <{+api+}/mongodb-driver-core/com/mongodb/event/CommandFailedEvent.html>`__ -- `ClusterListener <{+api+}/mongodb-driver-core/com/mongodb/event/ClusterListener.html>`__ -- `ClusterDescriptionChangedEvent <{+api+}/mongodb-driver-core/com/mongodb/event/ClusterDescriptionChangedEvent.html>`__ -- `ConnectionPoolListener <{+api+}/mongodb-driver-core/com/mongodb/event/ConnectionPoolListener.html>`__ -- `ConnectionCheckedOutEvent <{+api+}/mongodb-driver-core/com/mongodb/event/ConnectionCheckedOutEvent.html>`__ -- `ConnectionCheckOutFailedEvent <{+api+}/mongodb-driver-core/com/mongodb/event/ConnectionCheckOutFailedEvent.html>`__ +- `MongoClients <{+rs-driver-api+}/MongoClients.html>`__ +- `MongoClientSettings <{+core-api+}/MongoClientSettings.html>`__ +- `CommandListener <{+core-api+}/event/CommandListener.html>`__ +- `CommandStartedEvent <{+core-api+}/event/CommandStartedEvent.html>`__ +- `CommandSucceededEvent <{+core-api+}/event/CommandSucceededEvent.html>`__ +- `CommandFailedEvent <{+core-api+}/event/CommandFailedEvent.html>`__ +- `ClusterListener <{+core-api+}/event/ClusterListener.html>`__ +- `ClusterDescriptionChangedEvent <{+core-api+}/event/ClusterDescriptionChangedEvent.html>`__ +- `ConnectionPoolListener <{+core-api+}/event/ConnectionPoolListener.html>`__ +- `ConnectionCheckedOutEvent <{+core-api+}/event/ConnectionCheckedOutEvent.html>`__ +- `ConnectionCheckOutFailedEvent <{+core-api+}/event/ConnectionCheckOutFailedEvent.html>`__ diff --git a/source/read-write-configuration.txt b/source/read-write-configuration.txt index d4f0c526..337172fb 100644 --- a/source/read-write-configuration.txt +++ b/source/read-write-configuration.txt @@ -196,11 +196,11 @@ To learn more about any of the methods or types discussed in this guide, see the following API documentation: - `WriteConcern <{+api+}//mongodb-driver-core/com/mongodb/WriteConcern.html>`__ -- `MongoDatabase.withWriteConcern <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoDatabase.html#withWriteConcern(com.mongodb.WriteConcern)>`__ -- `MongoCollection.withWriteConcern <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#withWriteConcern(com.mongodb.WriteConcern)>`__ -- `ReadConcern <{+api+}/mongodb-driver-core/com/mongodb/ReadConcern.html>`__ -- `MongoDatabase.withReadConcern <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoDatabase.html#withReadConcern(com.mongodb.ReadConcern)>`__ -- `MongoCollection.withReadConcern <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#withReadPreference(com.mongodb.ReadPreference)>`__ -- `ReadPreference <{+api+}/mongodb-driver-core/com/mongodb/ReadPreference.html>`__ -- `MongoDatabase.withReadPreference <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoDatabase.html#withReadPreference(com.mongodb.ReadPreference)>`__ -- `MongoDatabase.withReadPreference <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#withReadPreference(com.mongodb.ReadPreference)>`__ +- `MongoDatabase.withWriteConcern <{+rs-driver-api+}/MongoDatabase.html#withWriteConcern(com.mongodb.WriteConcern)>`__ +- `MongoCollection.withWriteConcern <{+rs-driver-api+}/MongoCollection.html#withWriteConcern(com.mongodb.WriteConcern)>`__ +- `ReadConcern <{+core-api+}/ReadConcern.html>`__ +- `MongoDatabase.withReadConcern <{+rs-driver-api+}/MongoDatabase.html#withReadConcern(com.mongodb.ReadConcern)>`__ +- `MongoCollection.withReadConcern <{+rs-driver-api+}/MongoCollection.html#withReadPreference(com.mongodb.ReadPreference)>`__ +- `ReadPreference <{+core-api+}/ReadPreference.html>`__ +- `MongoDatabase.withReadPreference <{+rs-driver-api+}/MongoDatabase.html#withReadPreference(com.mongodb.ReadPreference)>`__ +- `MongoDatabase.withReadPreference <{+rs-driver-api+}/MongoCollection.html#withReadPreference(com.mongodb.ReadPreference)>`__ diff --git a/source/read/change-streams.txt b/source/read/change-streams.txt index 52914324..be36b52e 100644 --- a/source/read/change-streams.txt +++ b/source/read/change-streams.txt @@ -237,7 +237,7 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `MongoClient.watch() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClient.html#watch()>`__ -- `MongoCollection.watch() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#watch()>`__ -- `MongoDatabase.watch() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoDatabase.html#watch()>`__ -- `ChangeStreamPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/ChangeStreamPublisher.html>`__ \ No newline at end of file +- `MongoClient.watch() <{+rs-driver-api+}/MongoClient.html#watch()>`__ +- `MongoCollection.watch() <{+rs-driver-api+}/MongoCollection.html#watch()>`__ +- `MongoDatabase.watch() <{+rs-driver-api+}/MongoDatabase.html#watch()>`__ +- `ChangeStreamPublisher <{+rs-driver-api+}/ChangeStreamPublisher.html>`__ \ No newline at end of file diff --git a/source/read/count-documents.txt b/source/read/count-documents.txt index 709a05f3..fd393bd9 100644 --- a/source/read/count-documents.txt +++ b/source/read/count-documents.txt @@ -227,6 +227,6 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `countDocuments() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#countDocuments()>`__ -- `estimatedDocumentCount() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#estimatedDocumentCount()>`__ -- `Collation <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html#collation(com.mongodb.client.model.Collation)>`__ \ No newline at end of file +- `countDocuments() <{+rs-driver-api+}/MongoCollection.html#countDocuments()>`__ +- `estimatedDocumentCount() <{+rs-driver-api+}/MongoCollection.html#estimatedDocumentCount()>`__ +- `Collation <{+rs-driver-api+}/FindPublisher.html#collation(com.mongodb.client.model.Collation)>`__ \ No newline at end of file diff --git a/source/read/cursors.txt b/source/read/cursors.txt index 5b2f1af2..2065ddf1 100644 --- a/source/read/cursors.txt +++ b/source/read/cursors.txt @@ -103,6 +103,6 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `find() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#find()>`__ -- `FindPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html>`__ -- `CursorType <{+api+}/mongodb-driver-core/com/mongodb/CursorType.html>`__ +- `find() <{+rs-driver-api+}/MongoCollection.html#find()>`__ +- `FindPublisher <{+rs-driver-api+}/FindPublisher.html>`__ +- `CursorType <{+core-api+}/CursorType.html>`__ diff --git a/source/read/distinct.txt b/source/read/distinct.txt index 3dc80af4..18317265 100644 --- a/source/read/distinct.txt +++ b/source/read/distinct.txt @@ -130,7 +130,7 @@ The following table describes some methods you can use to customize the - | Sets the maximum amount of time to allow the operation to run, in milliseconds. For a complete list of methods you can use to modify the ``distinct()`` method, see -the `DistinctPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/DistinctPublisher.html>`__ API documentation. +the `DistinctPublisher <{+rs-driver-api+}/DistinctPublisher.html>`__ API documentation. The following example retrieves the distinct values of the ``name`` field for all documents that have a ``borough`` field value of ``"Bronx"`` and a @@ -166,5 +166,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `distinct() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#distinct(java.lang.String,java.lang.Class)>`__ -- `DistinctPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/DistinctPublisher.html>`__ \ No newline at end of file +- `distinct() <{+rs-driver-api+}/MongoCollection.html#distinct(java.lang.String,java.lang.Class)>`__ +- `DistinctPublisher <{+rs-driver-api+}/DistinctPublisher.html>`__ \ No newline at end of file diff --git a/source/read/retrieve-data.txt b/source/read/retrieve-data.txt index f60016e9..5cea7ab4 100644 --- a/source/read/retrieve-data.txt +++ b/source/read/retrieve-data.txt @@ -164,7 +164,7 @@ time of 10 seconds: .blockLast(); For a full list of available arguments, see the -`API documentation <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html>`__ +`API documentation <{+rs-driver-api+}/FindPublisher.html>`__ for the ``FindPublisher`` interface. .. _java-rs-retrieve-additional-information: @@ -183,6 +183,6 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `find() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#find()>`__ -- `FindPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html>`__ -- `Collation <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html#collation(com.mongodb.client.model.Collation)>`__ +- `find() <{+rs-driver-api+}/MongoCollection.html#find()>`__ +- `FindPublisher <{+rs-driver-api+}/FindPublisher.html>`__ +- `Collation <{+rs-driver-api+}/FindPublisher.html#collation(com.mongodb.client.model.Collation)>`__ diff --git a/source/read/specify-a-query.txt b/source/read/specify-a-query.txt index 16a63b68..51cdf220 100644 --- a/source/read/specify-a-query.txt +++ b/source/read/specify-a-query.txt @@ -265,5 +265,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `find() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#find()>`__ -- `FindPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html>`__ +- `find() <{+rs-driver-api+}/MongoCollection.html#find()>`__ +- `FindPublisher <{+rs-driver-api+}/FindPublisher.html>`__ diff --git a/source/read/specify-documents-to-return.txt b/source/read/specify-documents-to-return.txt index e548d684..24a529ae 100644 --- a/source/read/specify-documents-to-return.txt +++ b/source/read/specify-documents-to-return.txt @@ -173,8 +173,8 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `FindPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html>`__ -- `find() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#find()>`__ -- `limit() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html#limit(int)>`__ -- `sort() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html#sort(org.bson.conversions.Bson)>`__ -- `skip() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html#skip(int)>`__ \ No newline at end of file +- `FindPublisher <{+rs-driver-api+}/FindPublisher.html>`__ +- `find() <{+rs-driver-api+}/MongoCollection.html#find()>`__ +- `limit() <{+rs-driver-api+}/FindPublisher.html#limit(int)>`__ +- `sort() <{+rs-driver-api+}/FindPublisher.html#sort(org.bson.conversions.Bson)>`__ +- `skip() <{+rs-driver-api+}/FindPublisher.html#skip(int)>`__ \ No newline at end of file diff --git a/source/read/specify-fields-return.txt b/source/read/specify-fields-return.txt index 84fc7eb0..ec607f6d 100644 --- a/source/read/specify-fields-return.txt +++ b/source/read/specify-fields-return.txt @@ -162,5 +162,5 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API Documentation: -- `find() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#find()>`__ -- `FindPublisher <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/FindPublisher.html>`__ \ No newline at end of file +- `find() <{+rs-driver-api+}/MongoCollection.html#find()>`__ +- `FindPublisher <{+rs-driver-api+}/FindPublisher.html>`__ \ No newline at end of file diff --git a/source/security/encrypt.txt b/source/security/encrypt.txt index c06346ba..658fb085 100644 --- a/source/security/encrypt.txt +++ b/source/security/encrypt.txt @@ -25,4 +25,4 @@ .. tab:: Gradle :tabid: gradle-dependency - .. include:: source/includes/security/crypt-gradle-versioned.rst + .. include:: /includes/security/crypt-gradle-versioned.rst diff --git a/source/upgrade.txt b/source/upgrade.txt index a5597ec9..2c016f1e 100644 --- a/source/upgrade.txt +++ b/source/upgrade.txt @@ -159,7 +159,7 @@ This driver version introduces the following breaking changes: ``BsonDecimal128.isNumber()`` now returns ``true``, and ``BsonDecimal128.asNumber()`` returns the equivalent ``BsonNumber``. -- Removes the `ServerAddress <{+api+}/mongodb-driver-core/com/mongodb/ServerAddress.html>`__ +- Removes the `ServerAddress <{+core-api+}/ServerAddress.html>`__ methods ``getSocketAddress()`` and ``getSocketAddresses()``. Instead of ``getSocketAddress()``, use the ``getByName()`` instance @@ -168,7 +168,7 @@ This driver version introduces the following breaking changes: Instead of ``getSocketAddresses()``, use the ``getAllByName()`` instance method of ``java.net.InetAddress``. -- Removes the `UnixServerAddress <{+api+}/mongodb-driver-core/com/mongodb/UnixServerAddress.html>`__ +- Removes the `UnixServerAddress <{+core-api+}/UnixServerAddress.html>`__ methods ``getSocketAddress()`` and ``getUnixSocketAddress()``. Instead of ``getUnixSocketAddress()``, construct an instance of @@ -285,7 +285,7 @@ This driver version introduces the following breaking changes: - ``connectionRemoved`` For more information about the events package, see the `com.mongodb.event - package documentation <{+api+}/mongodb-driver-core/com/mongodb/event/package-summary.html>`__ + package documentation <{+core-api+}/event/package-summary.html>`__ .. _java-rs-breaking-changes-v5.0-list-collections: diff --git a/source/whats-new.txt b/source/whats-new.txt index 2435bef7..f0bbfe3e 100644 --- a/source/whats-new.txt +++ b/source/whats-new.txt @@ -48,6 +48,10 @@ and features: the :ref:`java-rs-write-update-docs`, :ref:`java-rs-write-replace`, and :ref:`java-rs-bulk-write` guides +- Implements a *client* bulk write API that allows you to perform write + operations on multiple databases and collections in the same call. To learn + more about this feature, see the :ref:`java-rs-client-bulk-write` + section of the Bulk Operations guide. .. _javars-version-5.2: @@ -67,7 +71,7 @@ and features: .. replacement:: avs-index-link - the `SearchIndexModel <{+api+}/mongodb-driver-core/com/mongodb/client/model/SearchIndexModel.html>`__ + the `SearchIndexModel <{+core-api+}/client/model/SearchIndexModel.html>`__ API documentation .. replacement:: encrypt-link diff --git a/source/write/bulk-writes.txt b/source/write/bulk-writes.txt index 23ddf0fb..2d32420a 100644 --- a/source/write/bulk-writes.txt +++ b/source/write/bulk-writes.txt @@ -19,12 +19,28 @@ Bulk Write Operations Overview -------- -In this guide, you can learn how to perform multiple write operations in a single database call by using **bulk write operations**. +In this guide, you can learn how to perform multiple write operations in +a single database call by using **bulk write operations**. -Consider a scenario in which you want to insert a document into a collection, +Consider a scenario in which you want to insert a document, update multiple other documents, then delete a document. If you use -individual methods, each operation requires its own database call. This guide -shows you how to use bulk write operations to reduce the number of calls to the database. +individual methods, each operation requires its own database call. + +By using a bulk write operation, you can perform multiple write operations in +fewer database calls. You can perform bulk write operations at the following levels: + +- :ref:`Collection `: You can use the + ``MongoCollection.bulkWrite()`` method to perform bulk write operations on a + single collection. In this method, each kind of write operation requires at + least one database call. For example, ``MongoCollection.bulkWrite()`` puts multiple update + operations in one call, but makes two separate calls to the database for an insert + operation and a replace operation. + +- :ref:`Client `: If your application connects to + {+mdb-server+} version 8.0 or later, you can use the ``MongoClient.bulkWrite()`` + method to perform bulk write operations on multiple collections and databases + in the same cluster. This method performs all write operations + in one database call. Sample Data ~~~~~~~~~~~ @@ -36,11 +52,18 @@ free MongoDB Atlas cluster and load the sample datasets, see the .. include:: /includes/reactor-note.rst -Define the Write Operations ---------------------------- +.. _java-rs-coll-bulk-write: + +Collection Bulk Write +--------------------- + +Bulk write operations contain one or more write operations. To perform a bulk +write operation at the collection level, pass a ``List`` of ``WriteModel`` +documents to the ``MongoCollection.bulkWrite()`` method. A ``WriteModel`` is a +model that represents a write operation. For each write operation you want to perform, create an instance of one of -the following classes: +the following classes that inherit from ``WriteModel``: - ``InsertOneModel`` - ``UpdateOneModel`` @@ -49,9 +72,8 @@ the following classes: - ``DeleteOneModel`` - ``DeleteManyModel`` -Then, pass a list of these instances to the ``bulkWrite()`` method. - -The following sections show how to create and use instances of the preceding classes. +The following sections show how to create and use instances of the +preceding classes. Insert Operations ~~~~~~~~~~~~~~~~~ @@ -174,10 +196,10 @@ The following example creates an instance of ``DeleteManyModel``: :copyable: :dedent: -Call the ``bulkWrite()`` Method --------------------------------- +Perform the Bulk Operation +~~~~~~~~~~~~~~~~~~~~~~~~~~ -After you define a class instance for each operation you want to perform, +After you define a ``WriteModel`` instance for each operation you want to perform, pass a list of these instances to the ``bulkWrite()`` method. By default, the method runs the operations in the order they're defined in the list. @@ -210,8 +232,8 @@ individual failure. collection on which the operation is running. The driver reports all write concern errors after attempting all operations, regardless of execution order. -Customize Bulk Write Operations -------------------------------- +Customize Bulk Write +~~~~~~~~~~~~~~~~~~~~ The ``BulkWriteOptions`` class contains methods that modify the behavior of the ``bulkWrite()`` method. To use the ``BulkWriteOptions`` @@ -284,6 +306,214 @@ reports the errors only after attempting all operations. Unordered bulk operations do not guarantee order of execution. The order can differ from the way you list them to optimize the runtime. +.. _java-rs-client-bulk-write: + +Client Bulk Write +----------------- + +When connecting to a deployment running {+mdb-server+} 8.0 or later, +you can use the ``MongoClient.bulkWrite()`` method to write +to multiple databases and collections in the same cluster. The +``MongoClient.bulkWrite()`` method performs all write operations in a +single call. + +The ``MongoClient.bulkWrite()`` method takes a +list of ``ClientNamespacedWriteModel`` instances to represent different write operations. +You can construct instances of the ``ClientNamespacedWriteModel`` interface by using +instance methods. For example, an instance of ``ClientNamespacedInsertOneModel`` represents an +operation to insert one document, and you can create this model by using +the ``ClientNamespacedWriteModel.insertOne()`` method. + +The models and their corresponding instance methods are described +in the table below. + +.. list-table:: + :header-rows: 1 + + * - Model + - Instance Method + - Description + - Parameters + + * - ``ClientNamespacedInsertOneModel`` + - ``insertOne()`` + - Creates a model to insert a document into the ``namespace``. + - ``namespace``: Database and collection to write to + + ``document``: Document to insert + + * - ``ClientNamespacedUpdateOneModel`` + - ``updateOne()`` + - Creates a model to update the first document in the ``namespace`` + that matches ``filter``. + - ``namespace``: Database and collection to write to + + ``filter``: Filter that selects which document to update + + ``update``: Update to apply to matching document + + ``updatePipeline``: Update pipeline to apply to matching document + + ``options``: *(optional)* Options to apply when updating document + + You must pass a value for either the ``update`` or ``updatePipeline`` + parameter. + + * - ``ClientNamespacedUpdateManyModel`` + - ``updateMany()`` + - Creates a model to update all documents in the ``namespace`` that match + ``filter``. + - ``namespace``: Database and collection to write to + + ``filter``: Filter that selects which documents to update + + ``update``: Update to apply to matching documents + + ``updatePipeline``: Update pipeline to apply to matching documents + + ``options``: *(optional)* Options to apply when updating documents + + You must pass a value for either the ``update`` or ``updatePipeline`` + parameter. + + * - ``ClientNamespacedReplaceOneModel`` + - ``replaceOne()`` + - Creates a model to replace the first document in the ``namespace`` that + matches ``filter``. + - ``namespace``: Database and collection to write to + + ``filter``: Filter that selects which document to replace + + ``replacement``: Replacement document + + ``options``: *(optional)* Options to apply when replacing documents + + * - ``ClientNamespacedDeleteOneModel`` + - ``deleteOne()`` + - Creates a model to delete the first document in the ``namespace`` that + matches ``filter``. + - ``namespace``: Database and collection to write to + + ``filter``: Filter that selects which document to delete + + ``option``: *(optional)* Options to apply when deleting document + + * - ``ClientNamespacedDeleteManyModel`` + - ``deleteMany()`` + - Creates a model to delete all documents in the ``namespace`` that match + ``filter``. + - ``namespace``: Database and collection to write to + + ``filter``: Filter that selects which documents to delete + + ``option``: *(optional)* Options to apply when deleting documents + +The following sections provide some examples of how to create models and use +the client ``bulkWrite()`` method. + +Insert Operations +~~~~~~~~~~~~~~~~~ + +This example shows how to create models that contain instructions to +insert two documents. One document is inserted into the ``db.people`` +collection, and the other document is inserted into the ``db.things`` collection. +The ``MongoNamespace`` instance defines the target database and collection that +each write operation applies to. + +.. literalinclude:: /includes/write/client-bulk-write.java + :start-after: start-insert-models + :end-before: end-insert-models + :language: java + :copyable: + :dedent: + +Replace Operations +~~~~~~~~~~~~~~~~~~ + +The following example shows how to create models to replace +existing documents in the ``db.people`` and ``db.things`` collections: + +.. literalinclude:: /includes/write/client-bulk-write.java + :start-after: start-replace-models + :end-before: end-replace-models + :language: java + :copyable: + :dedent: + +After this example runs successfully, the document that has an ``_id`` value of ``1`` +in the ``people`` collection is replaced with a new document. The document in +the ``things`` collection that has an ``_id`` value of ``1`` +is replaced with a new document. + +Perform the Bulk Operation +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +After you define a ``ClientNamespacedWriteModel`` instance for each +operation you want to perform, pass a list of these instances to the +client ``bulkWrite()`` method. By default, the method runs the +operations in the order they're specified. + +The following example performs multiple write operations by using the +``bulkWrite()`` method: + +.. io-code-block:: + :copyable: + + .. input:: /includes/write/client-bulk-write.java + :start-after: start-perform + :end-before: end-perform + :emphasize-lines: 18-19 + :language: java + :dedent: + + .. output:: + + AcknowledgedSummaryClientBulkWriteResult{insertedCount=1, matchedCount=1, ...} + +If any of the write operations fail, the driver raises a +``ClientBulkWriteException`` and does not perform any further individual operations. +``ClientBulkWriteException`` includes a ``BulkWriteError`` that can be accessed by using the +``ClientBulkWriteException.getWriteErrors()`` method, which provides details of the +individual failure. + +.. _java-rs-client-bulk-write-options: + +Customize Bulk Write +~~~~~~~~~~~~~~~~~~~~ + +You can pass an instance of ``ClientBulkWriteOptions`` to the +``bulkWrite()`` method to customize how the driver performs the bulk write +operation. + +Order of Execution +`````````````````` + +By default, the driver runs the individual operations in a bulk +operation in the order that you specify them until an error occurs, or +until the operation completes successfully. + +However, you can pass ``false`` to the ``ordered()`` method when creating +a ``ClientBulkWriteOptions`` instance to direct the driver to perform +write operations in an unordered way. When using the unordered option, +an error-producing operation does not prevent the driver from running +other write operations in the bulk write operation. + +The following code sets the ``ordered`` option to ``false`` in an +instance of ``ClientBulkWriteOptions`` and performs a bulk write operation to +insert multiple documents. + +.. literalinclude:: /includes/write/client-bulk-write.java + :start-after: start-options + :end-before: end-options + :emphasize-lines: 3-5, 23-24 + :language: java + :copyable: + :dedent: + +Even though the write operation inserting a document with a duplicate key results +in an error, the other operations are performed because the write operation is +unordered. + Additional Information ---------------------- @@ -300,13 +530,25 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `bulkWrite() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#bulkWrite(com.mongodb.reactivestreams.client.ClientSession,java.util.List)>`__ -- `InsertOneModel <{+api+}/mongodb-driver-core/com/mongodb/client/model/InsertOneModel.html>`__ -- `UpdateOneModel <{+api+}/mongodb-driver-core/com/mongodb/client/model/UpdateOneModel.html>`__ -- `UpdateManyModel <{+api+}/mongodb-driver-core/com/mongodb/client/model/UpdateManyModel.html>`__ -- `ReplaceOneModel <{+api+}/mongodb-driver-core/com/mongodb/client/model/ReplaceOneModel.html>`__ -- `DeleteOneModel <{+api+}/mongodb-driver-core/com/mongodb/client/model/DeleteOneModel.html>`__ -- `DeleteManyModel <{+api+}/mongodb-driver-core/com/mongodb/client/model/DeleteManyModel.html>`__ -- `BulkWriteResult <{+api+}/mongodb-driver-core/com/mongodb/bulk/BulkWriteResult.html>`__ -- `BulkWriteError <{+api+}/mongodb-driver-core/com/mongodb/bulk/BulkWriteError.html>`__ -- `MongoBulkWriteException <{+api+}/mongodb-driver-core/com/mongodb/MongoBulkWriteException.html>`__ +- Collection Bulk Write + + - `bulkWrite() + <{+rs-driver-api+}/MongoCollection.html#bulkWrite(com.mongodb.reactivestreams.client.ClientSession,java.util.List)>`__ + - `InsertOneModel <{+core-api+}/client/model/InsertOneModel.html>`__ + - `UpdateOneModel <{+core-api+}/client/model/UpdateOneModel.html>`__ + - `UpdateManyModel <{+core-api+}/client/model/UpdateManyModel.html>`__ + - `ReplaceOneModel <{+core-api+}/client/model/ReplaceOneModel.html>`__ + - `DeleteOneModel <{+core-api+}/client/model/DeleteOneModel.html>`__ + - `DeleteManyModel <{+core-api+}/client/model/DeleteManyModel.html>`__ + - `BulkWriteResult <{+core-api+}/bulk/BulkWriteResult.html>`__ + - `BulkWriteError <{+core-api+}/bulk/BulkWriteError.html>`__ + - `MongoBulkWriteException <{+core-api+}/MongoBulkWriteException.html>`__ + +- Client Bulk Write + + - `bulkWrite() + <{+rs-driver-api+}/MongoCluster.html#bulkWrite(java.util.List,com.mongodb.client.model.bulk.ClientBulkWriteOptions)>`__ + - `ClientNamespacedWriteModel <{+core-api+}/client/model/bulk/ClientNamespacedWriteModel.html>`__ + - `MongoNamespace <{+core-api+}/MongoNamespace.html>`__ + - `ClientBulkWriteOptions <{+core-api+}/client/model/bulk/ClientBulkWriteOptions.html>`__ + - `ClientBulkWriteResult <{+core-api+}/client/model/bulk/ClientBulkWriteResult.html>`__ diff --git a/source/write/insert-documents.txt b/source/write/insert-documents.txt index 3e94e38d..cbec3fd2 100644 --- a/source/write/insert-documents.txt +++ b/source/write/insert-documents.txt @@ -201,10 +201,10 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `insertOne() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#insertOne(com.mongodb.reactivestreams.client.ClientSession,TDocument)>`__ +- `insertOne() <{+rs-driver-api+}/MongoCollection.html#insertOne(com.mongodb.reactivestreams.client.ClientSession,TDocument)>`__ - `insertMany() - <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#insertMany(com.mongodb.reactivestreams.client.ClientSession,java.util.List)>`__ -- `InsertOneOptions <{+api+}/mongodb-driver-core/com/mongodb/client/model/InsertOneOptions.html>`__ + <{+rs-driver-api+}/MongoCollection.html#insertMany(com.mongodb.reactivestreams.client.ClientSession,java.util.List)>`__ +- `InsertOneOptions <{+core-api+}/client/model/InsertOneOptions.html>`__ - `InsertManyOptions - <{+api+}/mongodb-driver-core/com/mongodb/client/model/InsertManyOptions.html>`__ + <{+core-api+}/client/model/InsertManyOptions.html>`__ - `BsonValue <{+api+}/bson/org/bson/BsonValue.html>`__ \ No newline at end of file diff --git a/source/write/replace-documents.txt b/source/write/replace-documents.txt index 7e3ec2ae..40204e9c 100644 --- a/source/write/replace-documents.txt +++ b/source/write/replace-documents.txt @@ -218,8 +218,8 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `replaceOne() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#replaceOne(org.bson.conversions.Bson,TDocument)>`__ +- `replaceOne() <{+rs-driver-api+}/MongoCollection.html#replaceOne(org.bson.conversions.Bson,TDocument)>`__ - `ReplaceOptions - <{+api+}/mongodb-driver-core/com/mongodb/client/model/ReplaceOptions.html>`__ -- `UpdateResult <{+api+}/mongodb-driver-core/com/mongodb/client/result/UpdateResult.html>`__ + <{+core-api+}/client/model/ReplaceOptions.html>`__ +- `UpdateResult <{+core-api+}/client/result/UpdateResult.html>`__ - `BsonValue <{+api+}/bson/org/bson/BsonValue.html>`__ \ No newline at end of file diff --git a/source/write/run-command.txt b/source/write/run-command.txt index 103e89ae..8cad2bb0 100644 --- a/source/write/run-command.txt +++ b/source/write/run-command.txt @@ -67,4 +67,4 @@ API Documentation ~~~~~~~~~~~~~~~~~ To learn more about the ``runCommand()`` method, see the -`runCommand() API documentation <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoDatabase.html#runCommand(org.bson.conversions.Bson)>`__. +`runCommand() API documentation <{+rs-driver-api+}/MongoDatabase.html#runCommand(org.bson.conversions.Bson)>`__. diff --git a/source/write/transactions.txt b/source/write/transactions.txt index 8a7b39d1..6280f11d 100644 --- a/source/write/transactions.txt +++ b/source/write/transactions.txt @@ -127,8 +127,8 @@ API Documentation To learn more about any of the types or methods discussed in this guide, see the following API Documentation: -- `MongoClient <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClient.html>`__ -- `startSession() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoClient.html#startSession()>`__ -- `startTransaction() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/ClientSession.html#startTransaction()>`__ -- `abortTransaction() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/ClientSession.html#abortTransaction()>`__ -- `commitTransaction() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/ClientSession.html#commitTransaction()>`__ +- `MongoClient <{+rs-driver-api+}/MongoClient.html>`__ +- `startSession() <{+rs-driver-api+}/MongoClient.html#startSession()>`__ +- `startTransaction() <{+rs-driver-api+}/ClientSession.html#startTransaction()>`__ +- `abortTransaction() <{+rs-driver-api+}/ClientSession.html#abortTransaction()>`__ +- `commitTransaction() <{+rs-driver-api+}/ClientSession.html#commitTransaction()>`__ diff --git a/source/write/write-delete-documents.txt b/source/write/write-delete-documents.txt index 69c0eb0e..8cd8bfe5 100644 --- a/source/write/write-delete-documents.txt +++ b/source/write/write-delete-documents.txt @@ -176,15 +176,15 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `deleteOne() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#deleteOne(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson)>`__ +- `deleteOne() <{+rs-driver-api+}/MongoCollection.html#deleteOne(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson)>`__ - `deleteMany() - <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#deleteMany(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson)>`__ + <{+rs-driver-api+}/MongoCollection.html#deleteMany(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson)>`__ - `DeleteOptions - <{+api+}/mongodb-driver-core/com/mongodb/client/model/DeleteOptions.html>`__ + <{+core-api+}/client/model/DeleteOptions.html>`__ - `BsonValue <{+api+}/bson/org/bson/BsonValue.html>`__ - `Collation - <{+api+}/mongodb-driver-core/com/mongodb/client/model/Collation.html>`__ + <{+core-api+}/client/model/Collation.html>`__ diff --git a/source/write/write-update-documents.txt b/source/write/write-update-documents.txt index 6956db8e..5ad370b2 100644 --- a/source/write/write-update-documents.txt +++ b/source/write/write-update-documents.txt @@ -68,7 +68,7 @@ driver provides the ``Filters`` class that provides filter condition helper methods. To view a list of ``Filters`` helpers, see the `Filters -API documentation <{+api+}/mongodb-driver-core/com/mongodb/client/model/Filters.html>`__. +API documentation <{+core-api+}/client/model/Filters.html>`__. For more information about query filters, see the :manual:`Query Filter Documents section ` in the MongoDB Server manual. @@ -278,13 +278,13 @@ API Documentation To learn more about any of the methods or types discussed in this guide, see the following API documentation: -- `updateOne() <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#updateOne(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson,java.util.List)>`__ +- `updateOne() <{+rs-driver-api+}/MongoCollection.html#updateOne(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson,java.util.List)>`__ - `updateMany() - <{+api+}/mongodb-driver-reactivestreams/com/mongodb/reactivestreams/client/MongoCollection.html#updateMany(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson,java.util.List)>`__ + <{+rs-driver-api+}/MongoCollection.html#updateMany(com.mongodb.reactivestreams.client.ClientSession,org.bson.conversions.Bson,java.util.List)>`__ - `UpdateOptions - <{+api+}/mongodb-driver-core/com/mongodb/client/model/UpdateOptions.html>`__ -- `UpdateResult <{+api+}/mongodb-driver-core/com/mongodb/client/result/UpdateResult.html>`__ + <{+core-api+}/client/model/UpdateOptions.html>`__ +- `UpdateResult <{+core-api+}/client/result/UpdateResult.html>`__ - `BsonValue <{+api+}/bson/org/bson/BsonValue.html>`__ - `Collation - <{+api+}/mongodb-driver-core/com/mongodb/client/model/Collation.html>`__ \ No newline at end of file + <{+core-api+}/client/model/Collation.html>`__ \ No newline at end of file