Skip to content

Commit 0cd01da

Browse files
committedNov 14, 2022
docs: change "/docs/" links to be relative
re #12623
1 parent 8b306eb commit 0cd01da

29 files changed

+210
-211
lines changed
 

‎docs/connections.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ mongoose.set('bufferCommands', false);
7171
```
7272

7373
Note that buffering is also responsible for waiting until Mongoose
74-
creates collections if you use the [`autoCreate` option](/docs/guide.html#autoCreate).
74+
creates collections if you use the [`autoCreate` option](guide.html#autoCreate).
7575
If you disable buffering, you should also disable the `autoCreate`
76-
option and use [`createCollection()`](/docs/api/model.html#model_Model.createCollection)
77-
to create [capped collections](/docs/guide.html#capped) or
78-
[collections with collations](/docs/guide.html#collation).
76+
option and use [`createCollection()`](api/model.html#model_Model.createCollection)
77+
to create [capped collections](guide.html#capped) or
78+
[collections with collations](guide.html#collation).
7979

8080
```javascript
8181
const schema = new Schema({
@@ -149,15 +149,15 @@ Below are some of the options that are important for tuning Mongoose.
149149
* `useNewUrlParser` - The underlying MongoDB driver has deprecated their current [connection string](https://docs.mongodb.com/manual/reference/connection-string/) parser. Because this is a major change, they added the `useNewUrlParser` flag to allow users to fall back to the old parser if they find a bug in the new parser. You should set `useNewUrlParser: true` unless that prevents you from connecting. Note that if you specify `useNewUrlParser: true`, you **must** specify a port in your connection string, like `mongodb://localhost:27017/dbname`. The new url parser does _not_ support connection strings that do not have a port, like `mongodb://localhost/dbname`.
150150
* `useCreateIndex` - False by default. Set to `true` to make Mongoose's default index build use `createIndex()` instead of `ensureIndex()` to avoid deprecation warnings from the MongoDB driver.
151151
* `useFindAndModify` - True by default. Set to `false` to make `findOneAndUpdate()` and `findOneAndRemove()` use native `findOneAndUpdate()` rather than `findAndModify()`.
152-
* `useUnifiedTopology`- False by default. Set to `true` to opt in to using [the MongoDB driver's new connection management engine](/docs/deprecations.html#useunifiedtopology). You should set this option to `true`, except for the unlikely case that it prevents you from maintaining a stable connection.
152+
* `useUnifiedTopology`- False by default. Set to `true` to opt in to using [the MongoDB driver's new connection management engine](deprecations.html#useunifiedtopology). You should set this option to `true`, except for the unlikely case that it prevents you from maintaining a stable connection.
153153
* `promiseLibrary` - Sets the [underlying driver's promise library](http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html).
154154
* `poolSize` - The maximum number of sockets the MongoDB driver will keep open for this connection. By default, `poolSize` is 5. Keep in mind that, as of MongoDB 3.4, MongoDB only allows one operation per socket at a time, so you may want to increase this if you find you have a few slow queries that are blocking faster queries from proceeding. See [Slow Trains in MongoDB and Node.js](http://thecodebarbarian.com/slow-trains-in-mongodb-and-nodejs).
155155
* `socketTimeoutMS` - How long the MongoDB driver will wait before killing a socket due to inactivity _after initial connection_. A socket may be inactive because of either no activity or a long-running operation. This is set to `30000` by default, you should set this to 2-3x your longest running operation if you expect some of your database operations to run longer than 20 seconds. This option is passed to [Node.js `socket#setTimeout()` function](https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback) after the MongoDB driver successfully completes.
156156
* `family` - Whether to connect using IPv4 or IPv6. This option passed to [Node.js' `dns.lookup()`](https://nodejs.org/api/dns.html#dns_dns_lookup_hostname_options_callback) function. If you don't specify this option, the MongoDB driver will try IPv6 first and then IPv4 if IPv6 fails. If your `mongoose.connect(uri)` call takes a long time, try `mongoose.connect(uri, { family: 4 })`
157157
* `authSource` - The database to use when authenticating with `user` and `pass`. In MongoDB, [users are scoped to a database](https://docs.mongodb.com/manual/tutorial/manage-users-and-roles/). If you are getting an unexpected login failure, you may need to set this option.
158158

159159
The following options are important for tuning Mongoose only if you are
160-
running **without** [the `useUnifiedTopology` option](/docs/deprecations.html#useunifiedtopology):
160+
running **without** [the `useUnifiedTopology` option](deprecations.html#useunifiedtopology):
161161

162162
* `autoReconnect` - The underlying MongoDB driver will automatically try to reconnect when it loses connection to MongoDB. Unless you are an extremely advanced user that wants to manage their own connection pool, do **not** set this option to `false`.
163163
* `reconnectTries` - If you're connected to a single server or mongos proxy (as opposed to a replica set), the MongoDB driver will try to reconnect every `reconnectInterval` milliseconds for `reconnectTries` times, and give up afterward. When the driver gives up, the mongoose connection emits a `reconnectFailed` event. This option does nothing for replica set connections.
@@ -166,7 +166,7 @@ running **without** [the `useUnifiedTopology` option](/docs/deprecations.html#us
166166
* `connectTimeoutMS` - How long the MongoDB driver will wait before killing a socket due to inactivity _during initial connection_. Defaults to 30000. This option is passed transparently to [Node.js' `socket#setTimeout()` function](https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback).
167167

168168
The following options are important for tuning Mongoose only if you are
169-
running **with** [the `useUnifiedTopology` option](/docs/deprecations.html#useunifiedtopology):
169+
running **with** [the `useUnifiedTopology` option](deprecations.html#useunifiedtopology):
170170

171171
* `serverSelectionTimeoutMS` - With `useUnifiedTopology`, the MongoDB driver will try to find a server to send any given operation to, and keep retrying for `serverSelectionTimeoutMS` milliseconds. If not set, the MongoDB driver defaults to using `30000` (30 seconds).
172172
* `heartbeatFrequencyMS` - With `useUnifiedTopology`, the MongoDB driver sends a heartbeat every `heartbeatFrequencyMS` to check on the status of the connection. A heartbeat is subject to `serverSelectionTimeoutMS`, so the MongoDB driver will retry failed heartbeats for up to 30 seconds by default. Mongoose only emits a `'disconnected'` event after a heartbeat has failed, so you may want to decrease this setting to reduce the time between when your server goes down and when Mongoose emits `'disconnected'`. We recommend you do **not** set this setting below 1000, too many heartbeats can lead to performance degradation.
@@ -526,4 +526,4 @@ mongoose.connect(myUri, {
526526

527527
<h3 id="next">Next Up</h3>
528528

529-
Now that we've covered connections, let's take a look at [models](/docs/models.html).
529+
Now that we've covered connections, let's take a look at [models](models.html).

‎docs/deprecations.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ removed in a future version. To use the new parser, pass option
3232
The MongoDB Node.js driver rewrote the tool it uses to parse [MongoDB connection strings](https://docs.mongodb.com/manual/reference/connection-string/).
3333
Because this is such a big change, they put the new connection string parser
3434
behind a flag. To turn on this option, pass the `useNewUrlParser` option to
35-
[`mongoose.connect()`](/docs/api.html#mongoose_Mongoose-connect)
36-
or [`mongoose.createConnection()`](/docs/api.html#mongoose_Mongoose-createConnection).
35+
[`mongoose.connect()`](api.html#mongoose_Mongoose-connect)
36+
or [`mongoose.createConnection()`](api.html#mongoose_Mongoose-createConnection).
3737

3838
```javascript
3939
mongoose.connect(uri, { useNewUrlParser: true });
4040
mongoose.createConnection(uri, { useNewUrlParser: true });
4141
```
4242

43-
You can also [set the global `useNewUrlParser` option](/docs/api.html#mongoose_Mongoose-set)
43+
You can also [set the global `useNewUrlParser` option](api.html#mongoose_Mongoose-set)
4444
to turn on `useNewUrlParser` for every connection by default.
4545

4646
```javascript
@@ -56,7 +56,7 @@ with `{ useNewUrlParser: true }`, please [open an issue on GitHub](https://githu
5656

5757
<h2 id="findandmodify"><a href="#findandmodify"><code>findAndModify()</code></a></h2>
5858

59-
If you use [`Model.findOneAndUpdate()`](/docs/api.html#model_Model.findOneAndUpdate),
59+
If you use [`Model.findOneAndUpdate()`](api.html#model_Model.findOneAndUpdate),
6060
by default you'll see one of the below deprecation warnings.
6161

6262
```
@@ -67,7 +67,7 @@ DeprecationWarning: collection.findAndModify is deprecated. Use findOneAndUpdate
6767
Mongoose's `findOneAndUpdate()` long pre-dates the MongoDB driver's `findOneAndUpdate()`
6868
function, so it uses the MongoDB driver's [`findAndModify()` function](http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findAndModify)
6969
instead. You can opt in to using the MongoDB driver's `findOneAndUpdate()`
70-
function using the [`useFindAndModify` global option](/docs/api.html#mongoose_Mongoose-set).
70+
function using the [`useFindAndModify` global option](api.html#mongoose_Mongoose-set).
7171

7272
```javascript
7373
// Make Mongoose use `findOneAndUpdate()`. Note that this option is `true`
@@ -86,15 +86,15 @@ no intentional backwards breaking changes, so you should be able to turn
8686
this option on without any code changes. If you discover any issues,
8787
please [open an issue on GitHub](https://github.com/Automattic/mongoose/issues/new).
8888

89-
* [`Model.findByIdAndDelete()`](/docs/api.html#model_Model.findByIdAndDelete)
90-
* [`Model.findByIdAndRemove()`](/docs/api.html#model_Model.findByIdAndRemove)
91-
* [`Model.findByIdAndUpdate()`](/docs/api.html#model_Model.findByIdAndUpdate)
92-
* [`Model.findOneAndDelete()`](/docs/api.html#model_Model.findOneAndDelete)
93-
* [`Model.findOneAndRemove()`](/docs/api.html#model_Model.findOneAndRemove)
94-
* [`Model.findOneAndUpdate()`](/docs/api.html#model_Model.findOneAndUpdate)
95-
* [`Query.findOneAndDelete()`](/docs/api.html#query_Query-findOneAndDelete)
96-
* [`Query.findOneAndRemove()`](/docs/api.html#query_Query-findOneAndRemove)
97-
* [`Query.findOneAndUpdate()`](/docs/api.html#query_Query-findOneAndUpdate)
89+
* [`Model.findByIdAndDelete()`](api.html#model_Model.findByIdAndDelete)
90+
* [`Model.findByIdAndRemove()`](api.html#model_Model.findByIdAndRemove)
91+
* [`Model.findByIdAndUpdate()`](api.html#model_Model.findByIdAndUpdate)
92+
* [`Model.findOneAndDelete()`](api.html#model_Model.findOneAndDelete)
93+
* [`Model.findOneAndRemove()`](api.html#model_Model.findOneAndRemove)
94+
* [`Model.findOneAndUpdate()`](api.html#model_Model.findOneAndUpdate)
95+
* [`Query.findOneAndDelete()`](api.html#query_Query-findOneAndDelete)
96+
* [`Query.findOneAndRemove()`](api.html#query_Query-findOneAndRemove)
97+
* [`Query.findOneAndUpdate()`](api.html#query_Query-findOneAndUpdate)
9898

9999
You can also safely ignore this warning. Mongoose will not remove the legacy `useFindAndModify: true`
100100
behavior until Mongoose 6.0.
@@ -111,7 +111,7 @@ instead.
111111

112112
By default, Mongoose 5.x calls the [MongoDB driver's `ensureIndex()` function](http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#ensureIndex).
113113
The MongoDB driver deprecated this function in favor of [`createIndex()`](http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#createIndex).
114-
Set the [`useCreateIndex` global option](/docs/api.html#mongoose_Mongoose-set) to opt in to making Mongoose use `createIndex()` instead.
114+
Set the [`useCreateIndex` global option](api.html#mongoose_Mongoose-set) to opt in to making Mongoose use `createIndex()` instead.
115115

116116
```javascript
117117
mongoose.set('useCreateIndex', true);
@@ -144,7 +144,7 @@ deleteMany, or bulkWrite instead.
144144
```
145145

146146
To remove this deprecation warning, replace any usage of `remove()` with
147-
`deleteMany()`, _unless_ you specify the [`single` option to `remove()`](/docs/api.html#model_Model.remove). The `single`
147+
`deleteMany()`, _unless_ you specify the [`single` option to `remove()`](api.html#model_Model.remove). The `single`
148148
option limited `remove()` to deleting at most one document, so you should
149149
replace `remove(filter, { single: true })` with `deleteOne(filter)`.
150150

@@ -183,24 +183,24 @@ mongoose.set('useUnifiedTopology', true);
183183
```
184184

185185
The `useUnifiedTopology` option removes support for several
186-
[connection options](/docs/connections.html#options) that are
186+
[connection options](connections.html#options) that are
187187
no longer relevant with the new topology engine:
188188

189189
- `autoReconnect`
190190
- `reconnectTries`
191191
- `reconnectInterval`
192192

193193
When you enable `useUnifiedTopology`, please remove those options
194-
from your [`mongoose.connect()`](/docs/api/mongoose.html#mongoose_Mongoose-connect) or
195-
[`createConnection()`](/docs/api/mongoose.html#mongoose_Mongoose-createConnection) calls.
194+
from your [`mongoose.connect()`](api/mongoose.html#mongoose_Mongoose-connect) or
195+
[`createConnection()`](api/mongoose.html#mongoose_Mongoose-createConnection) calls.
196196

197197
If you find any unexpected behavior, please [open up an issue on GitHub](https://github.com/Automattic/mongoose/issues/new).
198198

199199
<h2 id="update"><a href="#update"><code>update()</code></a></h2>
200200

201-
Like `remove()`, the [`update()` function](/docs/api.html#model_Model.update) is deprecated in favor
202-
of the more explicit [`updateOne()`](/docs/api.html#model_Model.updateOne), [`updateMany()`](/docs/api.html#model_Model.updateMany), and [`replaceOne()`](/docs/api.html#model_Model.replaceOne) functions. You should replace
203-
`update()` with `updateOne()`, unless you use the [`multi` or `overwrite` options](/docs/api.html#model_Model.update).
201+
Like `remove()`, the [`update()` function](api.html#model_Model.update) is deprecated in favor
202+
of the more explicit [`updateOne()`](api.html#model_Model.updateOne), [`updateMany()`](api.html#model_Model.updateMany), and [`replaceOne()`](api.html#model_Model.replaceOne) functions. You should replace
203+
`update()` with `updateOne()`, unless you use the [`multi` or `overwrite` options](api.html#model_Model.update).
204204

205205
```
206206
collection.update is deprecated. Use updateOne, updateMany, or bulkWrite

‎docs/documents.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Read the [validation](validation.html) guide for more details.
140140

141141
There are 2 different ways to overwrite a document (replacing all keys in the
142142
document). One way is to use the
143-
[`Document#overwrite()` function](/docs/api/document.html#document_Document-overwrite)
143+
[`Document#overwrite()` function](api/document.html#document_Document-overwrite)
144144
followed by `save()`.
145145

146146
```javascript
@@ -151,7 +151,7 @@ doc.overwrite({ name: 'Jean-Luc Picard' });
151151
await doc.save();
152152
```
153153

154-
The other way is to use [`Model.replaceOne()`](/docs/api/model.html#model_Model.replaceOne).
154+
The other way is to use [`Model.replaceOne()`](api/model.html#model_Model.replaceOne).
155155

156156
```javascript
157157
// Sets `name` and unsets all other properties
@@ -161,4 +161,4 @@ await Person.replaceOne({ _id }, { name: 'Jean-Luc Picard' });
161161
### Next Up
162162

163163
Now that we've covered Documents, let's take a look at
164-
[Subdocuments](/docs/subdocs.html).
164+
[Subdocuments](subdocs.html).

‎docs/faq.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ doc.save();
2626
them mongoose never gets notified of the change and so doesn't know to
2727
persist the new value. There are two workarounds:
2828
[`MongooseArray#set`](api.html#types_array_MongooseArray.set) or
29-
[`Document#markModified()`](/docs/api/document.html#document_Document-markModified).
29+
[`Document#markModified()`](api/document.html#document_Document-markModified).
3030

3131
```javascript
3232
// Saves changes successfully
@@ -141,7 +141,7 @@ is undefined on the underlying [POJO](guide.html#minimize).
141141

142142
**A**. The only import syntax Mongoose supports is `import mongoose from 'mongoose'`.
143143
Syntaxes like `import * from 'mongoose'` or `import { model } from 'mongoose'` do **not** work.
144-
The global Mongoose object stores types, [global options](/docs/api.html#mongoose_Mongoose-set), and other important
144+
The global Mongoose object stores types, [global options](api.html#mongoose_Mongoose-set), and other important
145145
properties that Mongoose needs. When you do `import { model } from 'mongoose'`, the
146146
`this` value in `model()` is not the Mongoose global.
147147

@@ -425,7 +425,7 @@ Consider using a regex like `/^[a-f0-9]{24}$/` to test whether a string is exact
425425

426426
**A**. In order to avoid executing a separate query for each document returned from the `find` query, Mongoose
427427
instead queries using (numDocuments * limit) as the limit. If you need the correct limit, you should use the
428-
[perDocumentLimit](/docs/populate.html#limit-vs-perDocumentLimit) option (new in Mongoose 5.9.0). Just keep in
428+
[perDocumentLimit](populate.html#limit-vs-perDocumentLimit) option (new in Mongoose 5.9.0). Just keep in
429429
mind that populate() will execute a separate query for each document.
430430

431431
<hr id="duplicate-query" />

‎docs/geojson.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const citySchema = new mongoose.Schema({
5050
});
5151
```
5252

53-
Using [subdocuments](/docs/subdocs.html), you can define a common `pointSchema` and reuse it everywhere you want to store a GeoJSON point.
53+
Using [subdocuments](subdocs.html), you can define a common `pointSchema` and reuse it everywhere you want to store a GeoJSON point.
5454

5555
```javascript
5656
const pointSchema = new mongoose.Schema({
@@ -131,7 +131,7 @@ a polygon representing the state of Colorado using
131131
[require:geojson.*driver query]
132132
```
133133

134-
Mongoose also has a [`within()` helper](/docs/api.html#query_Query-within)
134+
Mongoose also has a [`within()` helper](api.html#query_Query-within)
135135
that's a shorthand for `$geoWithin`.
136136

137137
```javascript
@@ -148,7 +148,7 @@ a 2dsphere index on a GeoJSON point:
148148
[require:geojson.*index$]
149149
```
150150

151-
You can also define a geospatial index using the [`Schema#index()` function](/docs/api/schema.html#schema_Schema-index)
151+
You can also define a geospatial index using the [`Schema#index()` function](api/schema.html#schema_Schema-index)
152152
as shown below.
153153

154154
```javascript
@@ -157,4 +157,4 @@ citySchema.index({ location: '2dsphere' });
157157

158158
MongoDB's [`$near` query operator](https://docs.mongodb.com/v4.0/reference/operator/query/near/#op._S_near)
159159
and [`$geoNear` aggregation stage](https://docs.mongodb.com/manual/reference/operator/aggregation/geoNear/#pipe._S_geoNear)
160-
_require_ a 2dsphere index.
160+
_require_ a 2dsphere index.

0 commit comments

Comments
 (0)
Please sign in to comment.