You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That concludes the admin quick tour overview! Remember any [command]({{< docsref "/reference/command">}}) that doesn't have a specific helper can be called by the [database.runCommand()](http://api.mongodb.org/java/3.0/?com/mongodb/async/client/MongoDatabase.html#runCommand-org.bson.conversions.Bson-com.mongodb.ReadPreference-com.mongodb.async.SingleResultCallback-).
164
+
That concludes the admin quick tour overview! Remember any [command]({{< docsref "/reference/command">}}) that doesn't have a specific
165
+
helper can be called by the
166
+
[`runCommand()`]({{< apiref "com/mongodb/client/MongoDatabase.html#runCommand-org.bson.conversions.Bson-">}}) method on
method on the [`find()`]({{< apiref "com/mongodb/client/MongoCollection.html#find--">}})
175
175
operation. `collection.find().first()` returns the first document or null rather than a cursor.
176
176
This is useful for queries that should only match a single document, or if you are
177
177
interested in the first document only.
@@ -250,7 +250,8 @@ and it should just print just one document
250
250
251
251
252
252
{{% note %}}
253
-
Use the [Filters]({{< apiref "com/mongodb/client/model/Filters">}}), [Sorts]({{< apiref "com/mongodb/client/model/Sorts">}}) and [Projections]({{< apiref "com/mongodb/client/model/Projections">}})
253
+
Use the [`Filters`]({{< apiref "com/mongodb/client/model/Filters">}}), [`Sorts`]({{< apiref "com/mongodb/client/model/Sorts">}}) and
We can also use the [Sorts]({{< apiref "com/mongodb/client/model/Sorts">}}) helpers to sort documents.
286
-
We add a sort to a find query by calling the `sort()` method on a `FindIterable`. Below we use the [`exists()`]({{ < apiref "com/mongodb/client/model/Filters.html#exists-java.lang.String-">}}) helper and sort
286
+
We can also use the [`Sorts`]({{< apiref "com/mongodb/client/model/Sorts">}}) helpers to sort documents.
287
+
We add a sort to a find query by calling the `sort()` method on a `FindIterable`. Below we use the
288
+
[`exists()`]({{ < apiref "com/mongodb/client/model/Filters.html#exists-java.lang.String-">}}) helper and sort
287
289
[`descending("i")`]({{ < apiref "com/mongodb/client/model/Sorts.html#exists-java.lang.String-">}}) helper to
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
299
+
Sometimes we don't need all the data contained in a document, the [`Projections`]({{< apiref "com/mongodb/client/model/Projections">}})
300
+
helpers help build the projection parameter for the
298
301
find operation. Below we'll sort the collection, exclude the `_id` field and output the first
Copy file name to clipboardExpand all lines: docs/reference/content/reference/connecting/authenticating.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,13 @@ The Java driver supports all MongoDB [authentication mechanisms](http://docs.mon
13
13
only available in the MongoDB [Enterprise Edition](http://docs.mongodb.org/manual/administration/install-enterprise/).
14
14
15
15
An authentication credential is represented as an instance of the
16
-
[MongoCredential](http://api.mongodb.org/java/current/com/mongodb/MongoCredential.html) class, which includes static factory methods for
16
+
[`MongoCredential`]({{< apiref "com/mongodb/MongoCredential" >}}) class, which includes static factory methods for
17
17
each of the supported authentication mechanisms. A list of these instances must be passed to the driver via one of several
18
-
[MongoClient](http://api.mongodb.org/java/current/com/mongodb/MongoCredential.html) constructors that take a
19
-
parameter of type `List<MongoCredential>`.
18
+
[`MongoClient`]({{< apiref "com/mongodb/MongoClient" >}}) constructors that take either a
19
+
parameter of type `List<MongoCredential>`. Alternatively, a single [`MongoCredential`]({{< apiref "com/mongodb/MongoCredential" >}})
20
+
can be created implicity via a
21
+
[`MongoClientURI`]({{< apiref "com/mongodb/MongoClientURI" >}}) and passed to a [`MongoClient`]({{< apiref "com/mongodb/MongoClient" >}})
22
+
constructor that takes a `[`MongoClientURI`]({{< apiref "com/mongodb/MongoClientURI" >}}) parameter.
20
23
21
24
{{% note %}}
22
25
Given the flexibility of role-based access control in MongoDB, it is usually sufficient to authenticate with a single user, but, for completeness, the driver accepts a list of credentials.
Copy file name to clipboardExpand all lines: docs/reference/content/reference/connecting/index.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,12 +44,14 @@ mongodb://host:27017/mydb
44
44
Above, the database by the name of "mydb" is where the credentials are stored for the application.
45
45
46
46
{{% note %}}
47
-
Some drivers utilize the database component to indicate which database to work with by default. The Java driver, while it parses the database component, does not use the database component for anything other than authentication.
47
+
Some drivers utilize the database component to indicate which database to work with by default. The Java driver, while it parses the
48
+
database component, does not use the database component for anything other than authentication.
48
49
{{% /note %}}
49
50
50
51
#### Options
51
52
52
-
Many options can be provided via the connection string. The ones that cannot may be provided in a `MongoClientOptions` instance. To
53
+
Many options can be provided via the connection string. The ones that cannot may be provided in a
54
+
[`MongoClientOptions`]({{< apiref "com/mongodb/MongoClientOptions" >}}) instance. To
53
55
provide an option, append a `?` to the connection string and separate options by an `&`.
Finally, the `MongoClientOptions` class provides an in-code way to set the same options from a connection string. This is sometimes
82
+
Finally, the [`MongoClientOptions`]({{< apiref "com/mongodb/MongoClientOptions" >}}) class provides an in-code way to set the same options from a connection string. This is sometimes
82
83
necessary, as the connection string does not allow an application to configure as many configuration options as `MongoClientOptions`.
83
-
`MongoClientOptions` instances are immutable, so to create one your application uses a builder:
84
+
[`MongoClientOptions`]({{< apiref "com/mongodb/MongoClientOptions" >}}) instances are immutable, so to create one your application uses a builder:
Copy file name to clipboardExpand all lines: docs/reference/content/whats-new/index.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,12 @@ title = "What's New"
10
10
11
11
Key features of the 3.0 driver include:
12
12
13
-
- A generic [MongoCollection](http://api.mongodb.org/java/3.0/com/mongodb/client/MongoCollection.html) interface that complies with a new cross-driver [CRUD specification](https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst).
13
+
- A generic [`MongoCollection`]({{< apiref "com/mongodb/client/MongoCollection" >}}) interface that complies with a new cross-driver
0 commit comments