Skip to content

Commit a4f68ed

Browse files
committed
Documentation fixes
1 parent 272765b commit a4f68ed

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

docs/reference/content/driver-async/getting-started/quick-tour-admin.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ for instructions on how to install the MongoDB Driver.
2626

2727
## Setup
2828

29-
To get use started we'll quickly connect and create a `mongoClient`, `database` and `collection`
29+
To get started we'll quickly connect and create a `mongoClient`, `database` and `collection`
3030
variable for use in the examples below:
3131

3232
```java
@@ -35,6 +35,12 @@ MongoDatabase database = mongoClient.getDatabase("mydb");
3535
MongoCollection<Document> collection = database.getCollection("test");
3636
```
3737

38+
{{% note %}}
39+
Calling the `getDatabase()` on `MongoClient` does not create a database.
40+
Only when a database is written to will a database be created. Examples include the creation of an index or the insertion of a document
41+
into a previously non-existent collection.
42+
{{% /note %}}
43+
3844
{{% note %}}
3945
Sometimes you will need the same or similar callbacks more than once. In these situations
4046
it makes sense to DRY (Do not Repeat Yourself) up your code and save the callback either
@@ -64,11 +70,6 @@ mongoClient.listDatabaseNames().forEach(new Block<String>() {
6470
}, callbackWhenFinished);
6571
```
6672

67-
Calling the `getDatabase()` on `MongoClient` does not create a database.
68-
Only when a database is written to will a database be created. Examples
69-
would be creating an index or collection or inserting a document into a
70-
collection.
71-
7273
## Drop A Database
7374

7475
You can drop a database by name using a `MongoClient` instance:
@@ -79,7 +80,9 @@ mongoClient.getDatabase("databaseToBeDropped").drop(callbackWhenFinished);
7980

8081
## Create A Collection
8182

82-
Collections in MongoDB are created automatically simply by inserted a document into it. Using the `[createCollection]({{< apiref "com/mongodb/async/client/MongoDatabase.html#createCollection-java.lang.String-com.mongodb.async.SingleResultCallback-">}})` method, you can also create a collection explicitly in order to to customize its configuration. For example, to create a capped collection sized to 1 megabyte:
83+
Collections in MongoDB are created automatically simply by inserted a document into it. Using the
84+
[`createCollection`]({{< apiref "com/mongodb/async/client/MongoDatabase.html#createCollection-java.lang.String-com.mongodb.async.SingleResultCallback-">}})
85+
method, you can also create a collection explicitly in order to to customize its configuration. For example, to create a capped collection sized to 1 megabyte:
8386

8487
```java
8588
database.createCollection("cappedCollection",

docs/reference/content/driver-async/getting-started/quick-tour.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ server for the specified database.
6363
There is no callback required for `getDatabase("mydb")` as there is no network IO required.
6464
A `MongoDatabase` instance provides methods to interact with a database
6565
but the database might not actually exist and will only be created on the
66-
insertion of data via some means; eg the creation of a collection or the insertion of documents
66+
insertion of data via some means; e.g. the creation of a collection or the insertion of documents
6767
which do require callbacks as they require network IO.
6868
{{% /note %}}
6969

@@ -287,7 +287,7 @@ import static com.mongodb.client.model.Filters.*;
287287
collection.find(eq("i", 71)).first(printDocument);
288288
```
289289

290-
and it should return immediately and eventually print just one document:
290+
will eventually print just one document:
291291

292292
```json
293293
{ "_id" : { "$oid" : "5515836e58c7b4fbc756320b" }, "i" : 71 }
@@ -330,9 +330,9 @@ collection.find(exists("i")).sort(descending("i")).first(printDocument);
330330

331331
## Projecting fields
332332

333-
Sometimes we don't need all the data contained in a document, the [Projections]({{< apiref "com/mongodb/client/model/Projections">}}) helpers help build the projection parameter for the
334-
find operation. Below we'll sort the collection, exclude the `_id` field and output the first
335-
matching document:
333+
Sometimes we don't need all the data contained in a document. The [Projections]({{< apiref "com/mongodb/client/model/Projections">}})
334+
helpers can be used to build the projection parameter for the find operation and limit the fields returned.
335+
Below we'll sort the collection, exclude the `_id` field and output the first matching document:
336336

337337
```java
338338
collection.find().projection(excludeId()).first(printDocument);
@@ -370,7 +370,7 @@ collection.updateMany(lt("i", 100), new Document("$inc", new Document("i", 100))
370370
});
371371
```
372372

373-
The update methods return a [`UpdateResult`]({{< apiref "com/mongodb/client/result/UpdateResult.html">}})
373+
The update methods return an [`UpdateResult`]({{< apiref "com/mongodb/client/result/UpdateResult.html">}}),
374374
which provides information about the operation including the number of documents modified by the update.
375375

376376
## Deleting documents
@@ -387,8 +387,9 @@ collection.deleteOne(eq("i", 110), new SingleResultCallback<DeleteResult>() {
387387
});
388388
```
389389

390-
To delete all documents matching the filter use the [`deleteMany`]({{< apiref "com/mongodb/async/client/MongoCollection.html#deleteMany-org.bson.conversions.Bson-">}}) method.
391-
Here we delete all documents where `i` is greater or equal to `100`:
390+
To delete all documents matching the filter use the
391+
[`deleteMany`]({{< apiref "com/mongodb/async/client/MongoCollection.html#deleteMany-org.bson.conversions.Bson-">}}) method. Here we delete
392+
all documents where `i` is greater or equal to `100`:
392393

393394
```java
394395
collection.deleteMany(gte("i", 100), new SingleResultCallback<DeleteResult>() {
@@ -399,13 +400,13 @@ collection.deleteMany(gte("i", 100), new SingleResultCallback<DeleteResult>() {
399400
});
400401
```
401402

402-
The delete methods return a [`DeleteResult`]({{< apiref "com/mongodb/client/result/DeleteResult.html">}})
403+
The delete methods return a [`DeleteResult`]({{< apiref "com/mongodb/client/result/DeleteResult.html">}}),
403404
which provides information about the operation including the number of documents deleted.
404405

405406

406407
## Bulk operations
407408

408-
These new commands allow for the execution of bulk
409+
These commands allow for the execution of bulk
409410
insert/update/delete operations. There are two types of bulk operations:
410411

411412
1. Ordered bulk operations.

docs/reference/content/driver/getting-started/quick-tour-admin.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ for instructions on how to install the MongoDB Driver.
2626

2727
## Setup
2828

29-
To get use started we'll quickly connect and create a `mongoClient`, `database` and `collection`
29+
To get started we'll quickly connect and create a `mongoClient`, `database` and `collection`
3030
variable for use in the examples below:
3131

3232
```java
@@ -35,6 +35,12 @@ MongoDatabase database = mongoClient.getDatabase("mydb");
3535
MongoCollection<Document> collection = database.getCollection("test");
3636
```
3737

38+
{{% note %}}
39+
Calling the `getDatabase()` on `MongoClient` does not create a database.
40+
Only when a database is written to will a database be created. Examples include the creation of an index or the insertion of a document
41+
into a previously non-existent collection.
42+
{{% /note %}}
43+
3844
## Get A List of Databases
3945

4046
You can get a list of the available databases:
@@ -45,11 +51,6 @@ for (String name: mongoClient.listDatabaseNames()) {
4551
}
4652
```
4753

48-
Calling the `getDatabase()` on `MongoClient` does not create a database.
49-
Only when a database is written to will a database be created. Examples
50-
would be creating an index or collection or inserting a document into a
51-
collection.
52-
5354
## Drop A Database
5455

5556
You can drop a database by name using a `MongoClient` instance:
@@ -60,7 +61,8 @@ mongoClient.getDatabase("databaseToBeDropped").drop();
6061

6162
## Create A Collection
6263

63-
Collections in MongoDB are created automatically simply by inserted a document into it. Using the `[createCollection]({{< apiref "com/mongodb/client/MongoDatabase.html#createCollection-java.lang.String-">}})` method, you can also create a collection explicitly in order to to customize its configuration. For example, to create a capped collection sized to 1 megabyte:
64+
Collections in MongoDB are created automatically simply by inserted a document into it. Using the [`createCollection`]({{< apiref "com/mongodb/client/MongoDatabase.html#createCollection-java.lang.String-">}})
65+
method, you can also create a collection explicitly in order to to customize its configuration. For example, to create a capped collection sized to 1 megabyte:
6466

6567
```java
6668
database.createCollection("cappedCollection",

0 commit comments

Comments
 (0)