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
4 changes: 2 additions & 2 deletions snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ full-version = "{+version-number+}.2"
version = "v{+version-number+}"
mdb-server = "MongoDB Server"
stable-api = "Stable API"
api = "https://mongodb.github.io/mongo-java-driver/{+version-number+}/apidocs/mongodb-driver-kotlin-sync"
api = "https://mongodb.github.io/mongo-java-driver/{+version-number+}/apidocs/mongodb-driver-kotlin-sync/mongodb-driver-kotlin-sync"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side: This repeat in the URL is wierd - I would recommend copying the nested directories contents to the level up to remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into this and re-deploy the Kotlin API docs!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java-api = "https://mongodb.github.io/mongo-java-driver/{+version-number+}"
core-api = "{+java-api+}/apidocs/mongodb-driver-core/"
core-api = "{+java-api+}/apidocs/mongodb-driver-core"
kotlin-docs = "https://kotlinlang.org"
16 changes: 8 additions & 8 deletions source/connect/stable-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ API Documentation
For more information about using the {+stable-api+} with {+driver-short+}, see the
following API documentation:

- `ServerApi <{+core-api+}com/mongodb/ServerApi.html>`__
- `ServerApi.Builder <{+core-api+}com/mongodb/ServerApi.Builder.html>`__
- `ServerApiVersion <{+core-api+}com/mongodb/ServerApiVersion.html>`__
- `ServerAddress <{+core-api+}com/mongodb/ServerAddress.html>`__
- `MongoClientSettings <{+core-api+}com/mongodb/MongoClientSettings.html>`__
- `MongoClientSettings.Builder <{+core-api+}com/mongodb/MongoClientSettings.Builder.html>`__
- `MongoClient <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-client/index.html>`__
- `MongoClient.create() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-client/-factory/create.html>`__
- `ServerApi <{+core-api+}/com/mongodb/ServerApi.html>`__
- `ServerApi.Builder <{+core-api+}/com/mongodb/ServerApi.Builder.html>`__
- `ServerApiVersion <{+core-api+}/com/mongodb/ServerApiVersion.html>`__
- `ServerAddress <{+core-api+}/com/mongodb/ServerAddress.html>`__
- `MongoClientSettings <{+core-api+}/com/mongodb/MongoClientSettings.html>`__
- `MongoClientSettings.Builder <{+core-api+}/com/mongodb/MongoClientSettings.Builder.html>`__
- `MongoClient <{+api+}/com.mongodb.kotlin.client/-mongo-client/index.html>`__
- `MongoClient.create() <{+api+}/com.mongodb.kotlin.client/-mongo-client/-factory/create.html>`__
8 changes: 4 additions & 4 deletions source/data-formats/time-series.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ API Documentation
To learn more about the methods mentioned in this guide, see the following
API documentation:

- `createCollection() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-database/create-collection.html>`__
- `listCollections() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-database/list-collections.html>`__
- `insertOne() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/insert-one.html>`__
- `insertMany() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/insert-many.html>`__
- `createCollection() <{+api+}/com.mongodb.kotlin.client/-mongo-database/create-collection.html>`__
- `listCollections() <{+api+}/com.mongodb.kotlin.client/-mongo-database/list-collections.html>`__
- `insertOne() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/insert-one.html>`__
- `insertMany() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/insert-many.html>`__
81 changes: 81 additions & 0 deletions source/includes/write/bulk.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import com.mongodb.client.model.*
import com.mongodb.client.model.Filters.*
import com.mongodb.kotlin.client.MongoClient

// start-data-class
data class Restaurant(
val name: String,
val borough: String,
val cuisine: String
)
// end-data-class

fun main() {
val uri = "<connection string>"

val mongoClient = MongoClient.create(uri)
val database = mongoClient.getDatabase("sample_restaurants")
val collection = database.getCollection<Restaurant>("restaurants")

// start-bulk-insert-one
val blueMoon = InsertOneModel(Restaurant("Blue Moon Grill", "Brooklyn", "American"))
// end-bulk-insert-one

// start-bulk-update-one
val updateOneFilter = Filters.eq(Restaurant::name.name, "White Horse Tavern")
val updateOneDoc = Updates.set(Restaurant::borough.name, "Queens")
val tavernUpdate = UpdateOneModel<Restaurant>(updateOneFilter, updateOneDoc)
// end-bulk-update-one

// start-bulk-update-many
val updateManyFilter = Filters.eq(Restaurant::name.name, "Wendy's")
val updateManyDoc = Updates.set(Restaurant::cuisine.name, "Fast food")
val wendysUpdate = UpdateManyModel<Restaurant>(updateManyFilter, updateManyDoc)
// end-bulk-update-many

// start-bulk-replace-one
val replaceFilter = Filters.eq(Restaurant::name.name, "Cooper Town Diner")
val replaceDoc = Restaurant("Smith Town Diner", "Brooklyn", "American")
val replacement = ReplaceOneModel(replaceFilter, replaceDoc)
// end-bulk-replace-one

// start-bulk-delete-one
val deleteOne = DeleteOneModel<Restaurant>(Filters.eq(
Restaurant::name.name,
"Morris Park Bake Shop"
))
// end-bulk-delete-one

// start-bulk-delete-many
val deleteMany = DeleteManyModel<Restaurant>(Filters.eq(
Restaurant::cuisine.name,
"Experimental"
))
// end-bulk-delete-many

// start-bulk-write-mixed
val insertOneMdl = InsertOneModel(Restaurant("Red's Pizza", "Brooklyn", "Pizzeria"))
val updateOneMdl = UpdateOneModel<Restaurant>(
Filters.eq(Restaurant::name.name, "Moonlit Tavern"),
Updates.set(Restaurant::borough.name, "Queens")
)
val deleteManyMdl = DeleteManyModel<Restaurant>(
Filters.eq(Restaurant::name.name, "Crepe")
)

val bulkResult = collection.bulkWrite(
listOf(insertOneMdl, updateOneMdl, deleteManyMdl)
)

println(bulkResult)
// end-bulk-write-mixed

val bulkOperations = listOf(insertOneMdl, updateOneMdl, deleteManyMdl)

// start-bulk-write-unordered
val opts = BulkWriteOptions().ordered(false)
collection.bulkWrite(bulkOperations, opts)
// end-bulk-write-unordered

}

10 changes: 5 additions & 5 deletions source/indexes/atlas-search-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ each of the preceding methods.
Create a Search Index
---------------------

You can use the `createSearchIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/create-search-index.html>`__
and the `createSearchIndexes() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/create-search-indexes.html>`__
You can use the `createSearchIndex() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/create-search-index.html>`__
and the `createSearchIndexes() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/create-search-indexes.html>`__
methods to create one or more Atlas Search indexes.

The following code example shows how to create a single index:
Expand Down Expand Up @@ -77,7 +77,7 @@ List Search Indexes
-------------------

You can use the
`listSearchIndexes() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/list-search-indexes.html>`__
`listSearchIndexes() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/list-search-indexes.html>`__
method to return all Atlas Search indexes in a collection.

The following code example shows how to print a list of the search indexes in
Expand All @@ -95,7 +95,7 @@ Update a Search Index
---------------------

You can use the
`updateSearchIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/update-search-index.html>`__
`updateSearchIndex() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/update-search-index.html>`__
method to update an Atlas Search index.

The following code shows how to update a search index:
Expand All @@ -112,7 +112,7 @@ Delete a Search Index
---------------------

You can use the
`dropSearchIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/drop-search-index.html>`__
`dropSearchIndex() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/drop-search-index.html>`__
method to delete an Atlas Search index.

The following code shows how to delete a search index from a collection:
Expand Down
6 changes: 3 additions & 3 deletions source/indexes/compound-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ API Documentation
To learn more about any of the methods discussed in this guide, see the following API
documentation:

- `find() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `filter() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/filter.html>`__
- `sort() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/sort.html>`__
- `find() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `filter() <{+api+}/com.mongodb.kotlin.client/-find-iterable/filter.html>`__
- `sort() <{+api+}/com.mongodb.kotlin.client/-find-iterable/sort.html>`__
6 changes: 3 additions & 3 deletions source/indexes/single-field-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ API Documentation
To learn more about any of the methods discussed in this guide, see the following API
documentation:

- `find() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `filter() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/filter.html>`__
- `sort() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/sort.html>`__
- `find() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `filter() <{+api+}/com.mongodb.kotlin.client/-find-iterable/filter.html>`__
- `sort() <{+api+}/com.mongodb.kotlin.client/-find-iterable/sort.html>`__
4 changes: 2 additions & 2 deletions source/read/count.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@ 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-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/count-documents.html>`__
- `estimatedDocumentCount() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/estimated-document-count.html>`__
- `countDocuments() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/count-documents.html>`__
- `estimatedDocumentCount() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/estimated-document-count.html>`__
4 changes: 2 additions & 2 deletions source/read/project.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,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-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `projection() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/projection.html>`__
- `find() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `projection() <{+api+}/com.mongodb.kotlin.client/-find-iterable/projection.html>`__
6 changes: 3 additions & 3 deletions source/read/retrieve.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ number of documents returned by the query to ``10`` and set a maximum execution
:copyable:
:dedent:

For a full list of methods that modify the behavior of ``find()``, see the `API documentation <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/index.html>`__
For a full list of methods that modify the behavior of ``find()``, see the `API documentation <{+api+}/com.mongodb.kotlin.client/-find-iterable/index.html>`__
for the ``FindIterable`` class.

Additional Information
Expand All @@ -168,5 +168,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-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `FindIterable <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/index.html>`__
- `find() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `FindIterable <{+api+}/com.mongodb.kotlin.client/-find-iterable/index.html>`__
2 changes: 1 addition & 1 deletion source/read/specify-a-query.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,4 @@ 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-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `find() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
8 changes: 4 additions & 4 deletions source/read/specify-documents-to-return.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ 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-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `limit() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/limit.html>`__
- `sort() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/sort.html>`__
- `skip() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-find-iterable/skip.html>`__
- `find() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/find.html>`__
- `limit() <{+api+}/com.mongodb.kotlin.client/-find-iterable/limit.html>`__
- `sort() <{+api+}/com.mongodb.kotlin.client/-find-iterable/sort.html>`__
- `skip() <{+api+}/com.mongodb.kotlin.client/-find-iterable/skip.html>`__
8 changes: 4 additions & 4 deletions source/work-with-indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ API Documentation
To learn more about any of the methods or types discussed in this
guide, see the following API documentation:

- `createIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/create-index.html>`__
- `createIndexes() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/create-indexes.html>`__
- `dropIndex() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/drop-index.html>`__
- `dropIndexes() <{+api+}/mongodb-driver-kotlin-sync/com.mongodb.kotlin.client/-mongo-collection/drop-indexes.html>`__
- `createIndex() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/create-index.html>`__
- `createIndexes() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/create-indexes.html>`__
- `dropIndex() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/drop-index.html>`__
- `dropIndexes() <{+api+}/com.mongodb.kotlin.client/-mongo-collection/drop-indexes.html>`__
6 changes: 3 additions & 3 deletions source/write-operations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Write Data to MongoDB
/write/insert
/write/update
/write/delete
/write/bulk-write

..
/write/replace
/write/bulk-write
/write/gridfs

Overview
Expand Down Expand Up @@ -183,5 +183,5 @@ single bulk operation:
:copyable:
:dedent:

.. To learn more about the ``bulk_write()`` method, see the
.. :ref:`Bulk Write <kotlin-sync-bulk-write>` guide.
To learn more about the ``bulkWrite()`` method, see the
:ref:`Bulk Write <kotlin-sync-bulk-write>` guide.
Loading
Loading