Skip to content

Commit 8b306eb

Browse files
committedNov 14, 2022
docs: change relative links to no-prefix links
re #12690
1 parent 9ca46d1 commit 8b306eb

12 files changed

+139
-139
lines changed
 

‎docs/async-await.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async function awaitUpdate() {
6262
}
6363
```
6464

65-
Note that the specific fulfillment values of different Mongoose methods vary, and may be affected by configuration. Please refer to the [API documentation](./api.html) for information about specific methods.
65+
Note that the specific fulfillment values of different Mongoose methods vary, and may be affected by configuration. Please refer to the [API documentation](api.html) for information about specific methods.
6666

6767
### Async Functions
6868

@@ -108,7 +108,7 @@ Under the hood, [async/await is syntactic sugar](https://developer.mozilla.org/e
108108
Due to the surprisingly simple way promises are implemented in JavaScript, the keyword `await` will try to unwrap any object with a property whose key is the string ‘then’ and whose value is a function.
109109
Such objects belong to a broader class of objects called [thenables](https://masteringjs.io/tutorials/fundamentals/thenable).
110110
If the thenable being unwrapped is a genuine promise, e.g. an instance of the [Promise constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), we enjoy several guarantees about how the object’s ‘then’ function will behave.
111-
However, Mongoose provides several static helper methods that return a different class of thenable object called a [Query](./queries.html)--and [Queries are not promises](./queries.html#queries-are-not-promises).
111+
However, Mongoose provides several static helper methods that return a different class of thenable object called a [Query](queries.html)--and [Queries are not promises](queries.html#queries-are-not-promises).
112112
Because Queries are also *thenables*, we can interact with a Query using async/await just as we would interact with a genuine promise, with one key difference: observing the fulfillment value of a genuine promise cannot under any circumstances change that value, but trying to re-observe the value of a Query may cause the Query to be re-executed.
113113

114114
```javascript
@@ -148,4 +148,4 @@ async function observeQuery() {
148148

149149
You are most likely to accidentally re-execute queries in this way when mixing callbacks with async/await.
150150
This is never necessary and should be avoided.
151-
If you need a Query to return a fully-fleged promise instead of a thenable, you can use [Query#exec()](./api/query.html#query_Query-exec).
151+
If you need a Query to return a fully-fleged promise instead of a thenable, you can use [Query#exec()](api/query.html#query_Query-exec).

‎docs/connections.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ setTimeout(function() {
6161
}, 60000);
6262
```
6363

64-
To disable buffering, turn off the [`bufferCommands` option on your schema](./guide.html#bufferCommands).
64+
To disable buffering, turn off the [`bufferCommands` option on your schema](guide.html#bufferCommands).
6565
If you have `bufferCommands` on and your connection is hanging, try turning
6666
`bufferCommands` off to see if you haven't opened a connection properly.
6767
You can also disable `bufferCommands` globally:
@@ -199,7 +199,7 @@ See [this page](http://mongodb.github.io/node-mongodb-native/3.1/reference/faq/)
199199
<h3 id="callback"><a href="#callback">Callback</a></h3>
200200

201201
The `connect()` function also accepts a callback parameter and returns a
202-
[promise](./promises.html).
202+
[promise](promises.html).
203203

204204
```javascript
205205
mongoose.connect(uri, options, function(error) {
@@ -396,8 +396,8 @@ The `mongoose.createConnection()` function takes the same arguments as
396396
const conn = mongoose.createConnection('mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]', options);
397397
```
398398

399-
This [connection](./api.html#connection_Connection) object is then used to
400-
create and retrieve [models](./api.html#model_Model). Models are
399+
This [connection](api.html#connection_Connection) object is then used to
400+
create and retrieve [models](api.html#model_Model). Models are
401401
**always** scoped to a single connection.
402402

403403
```javascript
@@ -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](/docs/models.html).

‎docs/documents.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Documents
22

3-
Mongoose [documents](./api/document.html) represent a one-to-one mapping
3+
Mongoose [documents](api/document.html) represent a one-to-one mapping
44
to documents as stored in MongoDB. Each document is an instance of its
5-
[Model](./models.html).
5+
[Model](models.html).
66

77
<ul class="toc">
88
<li><a href="#documents-vs-models">Documents vs Models</a></li>
@@ -134,7 +134,7 @@ await Person.updateOne({}, { age: 'bar' });
134134
await Person.updateOne({}, { age: -1 }, { runValidators: true });
135135
```
136136

137-
Read the [validation](./validation.html) guide for more details.
137+
Read the [validation](validation.html) guide for more details.
138138

139139
<h2 id="overwriting"><a href="#overwriting">Overwriting</a></h2>
140140

@@ -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](/docs/subdocs.html).

‎docs/faq.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ doc.save();
2525
**A**. Mongoose doesn't create getters/setters for array indexes; without
2626
them mongoose never gets notified of the change and so doesn't know to
2727
persist the new value. There are two workarounds:
28-
[`MongooseArray#set`](./api.html#types_array_MongooseArray.set) or
28+
[`MongooseArray#set`](api.html#types_array_MongooseArray.set) or
2929
[`Document#markModified()`](/docs/api/document.html#document_Document-markModified).
3030

3131
```javascript
@@ -123,7 +123,7 @@ console.log(new Model());
123123

124124
**A**. This is a performance optimization. These empty objects are not saved
125125
to the database, nor are they in the result `toObject()`, nor do they show
126-
up in `JSON.stringify()` output unless you turn off the [`minimize` option](./guide.html#minimize).
126+
up in `JSON.stringify()` output unless you turn off the [`minimize` option](guide.html#minimize).
127127

128128
The reason for this behavior is that Mongoose's change detection
129129
and getters/setters are based on [`Object.defineProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty).
@@ -132,7 +132,7 @@ the overhead of running `Object.defineProperty()` every time a document is creat
132132
mongoose defines properties on the `Model` prototype when the model is compiled.
133133
Because mongoose needs to define getters and setters for `nested.prop`, `nested`
134134
must always be defined as an object on a mongoose document, even if `nested`
135-
is undefined on the underlying [POJO](./guide.html#minimize).
135+
is undefined on the underlying [POJO](guide.html#minimize).
136136

137137
<hr id="destructured-imports" />
138138

@@ -161,7 +161,7 @@ foo(); // "undefined"
161161

162162
<hr id="arrow-functions" />
163163

164-
<a href="#arrow-functions">**Q**</a>. I'm using an arrow function for a [virtual](./guide.html#virtuals), [middleware](./middleware.html), [getter](./api.html#schematype_SchemaType-get)/[setter](./api.html#schematype_SchemaType-set), or [method](./guide.html#methods) and the value of `this` is wrong.
164+
<a href="#arrow-functions">**Q**</a>. I'm using an arrow function for a [virtual](guide.html#virtuals), [middleware](middleware.html), [getter](api.html#schematype_SchemaType-get)/[setter](api.html#schematype_SchemaType-set), or [method](guide.html#methods) and the value of `this` is wrong.
165165

166166
**A**. Arrow functions [handle the `this` keyword much differently than conventional functions](https://masteringjs.io/tutorials/fundamentals/arrow#why-not-arrow-functions).
167167
Mongoose getters/setters depend on `this` to give you access to the document that you're writing to, but this functionality does not work with arrow functions. Do **not** use arrow functions for mongoose getters/setters unless do not intend to access the document in the getter/setter.
@@ -254,7 +254,7 @@ new Schema({
254254
<a href="#model_functions_hanging">**Q**</a>. All function calls on my models hang, what am I doing wrong?
255255

256256
**A**. By default, mongoose will buffer your function calls until it can
257-
connect to MongoDB. Read the [buffering section of the connection docs](./connections.html#buffering)
257+
connect to MongoDB. Read the [buffering section of the connection docs](connections.html#buffering)
258258
for more information.
259259

260260
<hr id="enable_debugging" />
@@ -274,7 +274,7 @@ mongoose.set('debug', { color: false })
274274
mongoose.set('debug', { shell: true })
275275
```
276276

277-
For more debugging options (streams, callbacks), see the ['debug' option under `.set()`](./api.html#mongoose_Mongoose-set).
277+
For more debugging options (streams, callbacks), see the ['debug' option under `.set()`](api.html#mongoose_Mongoose-set).
278278

279279
<hr id="callback_never_executes" />
280280

@@ -458,4 +458,4 @@ await BlogPost.updateOne({ title: 'Introduction to Promises' }, update, (err, re
458458

459459
**Something to add?**
460460

461-
If you'd like to contribute to this page, please [visit it](https://github.com/Automattic/mongoose/tree/master/docs/faq.md) on github and use the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button to send a pull request.
461+
If you'd like to contribute to this page, please [visit it](https://github.com/Automattic/mongoose/tree/master/docs/faq.md) on github and use the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button to send a pull request.

‎docs/guide.md

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Schemas
22

3-
If you haven't yet done so, please take a minute to read the [quickstart](./index.html) to get an idea of how Mongoose works.
3+
If you haven't yet done so, please take a minute to read the [quickstart](index.html) to get an idea of how Mongoose works.
44
If you are migrating from 4.x to 5.x please take a moment to read the [migration guide](/docs/migrating_to_5.html).
55

66
<ul class="toc">
@@ -43,12 +43,12 @@ collection and defines the shape of the documents within that collection.
4343
```
4444

4545
If you want to add additional keys later, use the
46-
[Schema#add](./api.html#schema_Schema-add) method.
46+
[Schema#add](api.html#schema_Schema-add) method.
4747

4848
Each key in our code `blogSchema` defines a property in our documents which
49-
will be cast to its associated [SchemaType](./api.html#schematype_SchemaType).
49+
will be cast to its associated [SchemaType](api.html#schematype_SchemaType).
5050
For example, we've defined a property `title` which will be cast to the
51-
[String](./api.html#schema-string-js) SchemaType and property `date`
51+
[String](api.html#schema-string-js) SchemaType and property `date`
5252
which will be cast to a `Date` SchemaType.
5353

5454
Notice above that if a property only requires a type, it can be specified using
@@ -63,34 +63,34 @@ In these cases, Mongoose only creates actual schema paths for leaves
6363
in the tree. (like `meta.votes` and `meta.favs` above),
6464
and the branches do not have actual paths. A side-effect of this is that `meta`
6565
above cannot have its own validation. If validation is needed up the tree, a path
66-
needs to be created up the tree - see the [Subdocuments](./subdocs.html) section
67-
for more information on how to do this. Also read the [Mixed](./schematypes.html)
66+
needs to be created up the tree - see the [Subdocuments](subdocs.html) section
67+
for more information on how to do this. Also read the [Mixed](schematypes.html)
6868
subsection of the SchemaTypes guide for some gotchas.
6969

7070
The permitted SchemaTypes are:
7171

72-
* [String](./schematypes.html#strings)
73-
* [Number](./schematypes.html#numbers)
74-
* [Date](./schematypes.html#dates)
75-
* [Buffer](./schematypes.html#buffers)
76-
* [Boolean](./schematypes.html#booleans)
77-
* [Mixed](./schematypes.html#mixed)
78-
* [ObjectId](./schematypes.html#objectids)
79-
* [Array](./schematypes.html#arrays)
80-
* [Decimal128](./api.html#mongoose_Mongoose-Decimal128)
81-
* [Map](./schematypes.html#maps)
72+
* [String](schematypes.html#strings)
73+
* [Number](schematypes.html#numbers)
74+
* [Date](schematypes.html#dates)
75+
* [Buffer](schematypes.html#buffers)
76+
* [Boolean](schematypes.html#booleans)
77+
* [Mixed](schematypes.html#mixed)
78+
* [ObjectId](schematypes.html#objectids)
79+
* [Array](schematypes.html#arrays)
80+
* [Decimal128](api.html#mongoose_Mongoose-Decimal128)
81+
* [Map](schematypes.html#maps)
8282

83-
Read more about [SchemaTypes here](./schematypes.html).
83+
Read more about [SchemaTypes here](schematypes.html).
8484

8585
Schemas not only define the structure of your document and casting of
8686
properties, they also define document [instance methods](#methods),
8787
[static Model methods](#statics), [compound indexes](#indexes),
88-
and document lifecycle hooks called [middleware](./middleware.html).
88+
and document lifecycle hooks called [middleware](middleware.html).
8989

9090
<h3 id="models"><a href="#models">Creating a model</a></h3>
9191

9292
To use our schema definition, we need to convert our `blogSchema` into a
93-
[Model](./models.html) we can work with.
93+
[Model](models.html) we can work with.
9494
To do so, we pass it into `mongoose.model(modelName, schema)`:
9595

9696
```javascript
@@ -137,8 +137,8 @@ await doc.save(); // works
137137

138138
<h3 id="methods"><a href="#methods">Instance methods</a></h3>
139139

140-
Instances of `Models` are [documents](./documents.html). Documents have
141-
many of their own [built-in instance methods](./api/document.html).
140+
Instances of `Models` are [documents](documents.html). Documents have
141+
many of their own [built-in instance methods](api/document.html).
142142
We may also define our own custom document instance methods.
143143

144144
```javascript
@@ -163,8 +163,8 @@ to them.
163163
});
164164
```
165165

166-
* Overwriting a default mongoose document method may lead to unpredictable results. See [this](./api.html#schema_Schema.reserved) for more details.
167-
* The example above uses the `Schema.methods` object directly to save an instance method. You can also use the `Schema.method()` helper as described [here](./api.html#schema_Schema-method).
166+
* Overwriting a default mongoose document method may lead to unpredictable results. See [this](api.html#schema_Schema.reserved) for more details.
167+
* The example above uses the `Schema.methods` object directly to save an instance method. You can also use the `Schema.method()` helper as described [here](api.html#schema_Schema-method).
168168
* Do **not** declare methods using ES6 arrow functions (`=>`). Arrow functions [explicitly prevent binding `this`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#No_binding_of_this), so your method will **not** have access to the document and the above examples will not work.
169169

170170
<h3 id="statics"><a href="#statics">Statics</a></h3>
@@ -194,7 +194,7 @@ Do **not** declare statics using ES6 arrow functions (`=>`). Arrow functions [ex
194194

195195
You can also add query helper functions, which are like instance methods
196196
but for mongoose queries. Query helper methods let you extend mongoose's
197-
[chainable query builder API](./queries.html).
197+
[chainable query builder API](queries.html).
198198

199199
```javascript
200200
animalSchema.query.byName = function(name) {
@@ -215,7 +215,7 @@ but for mongoose queries. Query helper methods let you extend mongoose's
215215
<h3 id="indexes"><a href="#indexes">Indexes</a></h3>
216216

217217
MongoDB supports [secondary indexes](http://docs.mongodb.org/manual/indexes/).
218-
With mongoose, we define these indexes within our `Schema` [at](./api.html#schematype_SchemaType-index) [the](./api.html#schematype_SchemaType-unique) [path](./api.html#schematype_SchemaType-sparse) [level](./api.html#schema_date_SchemaDate-expires) or the `schema` level.
218+
With mongoose, we define these indexes within our `Schema` [at](api.html#schematype_SchemaType-index) [the](api.html#schematype_SchemaType-unique) [path](api.html#schematype_SchemaType-sparse) [level](api.html#schema_date_SchemaDate-expires) or the `schema` level.
219219
Defining indexes at the schema level is necessary when creating
220220
[compound indexes](https://docs.mongodb.com/manual/core/index-compound/).
221221

@@ -259,11 +259,11 @@ building or an error occurred.
259259
});
260260
```
261261

262-
See also the [Model#ensureIndexes](./api.html#model_Model.ensureIndexes) method.
262+
See also the [Model#ensureIndexes](api.html#model_Model.ensureIndexes) method.
263263

264264
<h3 id="virtuals"><a href="#virtuals">Virtuals</a></h3>
265265

266-
[Virtuals](./api.html#schema_Schema-virtual) are document properties that
266+
[Virtuals](api.html#schema_Schema-virtual) are document properties that
267267
you can get and set but that do not get persisted to MongoDB. The getters
268268
are useful for formatting or combining fields, while setters are useful for
269269
de-composing a single value into multiple values for storage.
@@ -296,7 +296,7 @@ But [concatenating](https://masteringjs.io/tutorials/fundamentals/string-concat)
296296
last name every time can get cumbersome.
297297
And what if you want to do some extra processing on the name, like
298298
[removing diacritics](https://www.npmjs.com/package/diacritics)? A
299-
[virtual property getter](./api.html#virtualtype_VirtualType-get) lets you
299+
[virtual property getter](api.html#virtualtype_VirtualType-get) lets you
300300
define a `fullName` property that won't get persisted to MongoDB.
301301

302302
```javascript
@@ -316,7 +316,7 @@ If you use `toJSON()` or `toObject()` mongoose will *not* include virtuals
316316
by default. This includes the output of calling [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)
317317
on a Mongoose document, because [`JSON.stringify()` calls `toJSON()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description).
318318
Pass `{ virtuals: true }` to either
319-
[`toObject()`](./api.html#document_Document-toObject) or [`toJSON()`](./api.html#document_Document-toJSON).
319+
[`toObject()`](api.html#document_Document-toObject) or [`toJSON()`](api.html#document_Document-toJSON).
320320

321321
You can also add a custom setter to your virtual that will let you set both
322322
first name and last name via the `fullName` virtual.
@@ -518,7 +518,7 @@ new Schema({..}, { capped: { size: 1024, max: 1000, autoIndexId: true } });
518518
<h3 id="collection"><a href="#collection">option: collection</a></h3>
519519

520520
Mongoose by default produces a collection name by passing the model name to
521-
the [utils.toCollectionName](./api.html#utils_exports.toCollectionName) method.
521+
the [utils.toCollectionName](api.html#utils_exports.toCollectionName) method.
522522
This method pluralizes the name. Set this option if you need a different name
523523
for your collection.
524524

@@ -1061,7 +1061,7 @@ thing.save(); // version is not incremented
10611061
<h3 id="timestamps"><a href="#timestamps">option: timestamps</a></h3>
10621062

10631063
The `timestamps` option tells mongoose to assign `createdAt` and `updatedAt` fields
1064-
to your schema. The type assigned is [Date](./api.html#schema-date-js).
1064+
to your schema. The type assigned is [Date](api.html#schema-date-js).
10651065

10661066
By default, the names of the fields are `createdAt` and `updatedAt`. Customize
10671067
the field names by setting `timestamps.createdAt` and `timestamps.updatedAt`.
@@ -1255,7 +1255,7 @@ console.log(schema.virtuals); // { myVirtual: VirtualType { ... } }
12551255

12561256
<h3 id="plugins"><a href="#plugins">Pluggable</a></h3>
12571257

1258-
Schemas are also [pluggable](./plugins.html) which allows us to package up reusable features into
1258+
Schemas are also [pluggable](plugins.html) which allows us to package up reusable features into
12591259
plugins that can be shared with the community or just between your projects.
12601260

12611261
<h3 id="further-reading">Further Reading</h3>

‎docs/middleware.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Middleware (also called pre and post *hooks*) are functions which are passed
44
control during execution of asynchronous functions. Middleware is specified
5-
on the schema level and is useful for writing [plugins](./plugins.html).
5+
on the schema level and is useful for writing [plugins](plugins.html).
66

77
<ul class="toc">
88
<li><a href="#types-of-middleware">Types of Middleware</a></li>
@@ -36,37 +36,37 @@ In document middleware functions, `this` refers to the document.
3636
Query middleware is supported for the following Model and Query functions.
3737
In query middleware functions, `this` refers to the query.
3838

39-
* [count](./api.html#query_Query-count)
40-
* [deleteMany](./api.html#query_Query-deleteMany)
41-
* [deleteOne](./api.html#query_Query-deleteOne)
42-
* [find](./api.html#query_Query-find)
43-
* [findOne](./api.html#query_Query-findOne)
44-
* [findOneAndDelete](./api.html#query_Query-findOneAndDelete)
45-
* [findOneAndRemove](./api.html#query_Query-findOneAndRemove)
46-
* [findOneAndUpdate](./api.html#query_Query-findOneAndUpdate)
47-
* [remove](./api.html#model_Model.remove)
48-
* [update](./api.html#query_Query-update)
49-
* [updateOne](./api.html#query_Query-updateOne)
50-
* [updateMany](./api.html#query_Query-updateMany)
39+
* [count](api.html#query_Query-count)
40+
* [deleteMany](api.html#query_Query-deleteMany)
41+
* [deleteOne](api.html#query_Query-deleteOne)
42+
* [find](api.html#query_Query-find)
43+
* [findOne](api.html#query_Query-findOne)
44+
* [findOneAndDelete](api.html#query_Query-findOneAndDelete)
45+
* [findOneAndRemove](api.html#query_Query-findOneAndRemove)
46+
* [findOneAndUpdate](api.html#query_Query-findOneAndUpdate)
47+
* [remove](api.html#model_Model.remove)
48+
* [update](api.html#query_Query-update)
49+
* [updateOne](api.html#query_Query-updateOne)
50+
* [updateMany](api.html#query_Query-updateMany)
5151

5252
Aggregate middleware is for `MyModel.aggregate()`. Aggregate middleware
5353
executes when you call `exec()` on an aggregate object.
54-
In aggregate middleware, `this` refers to the [aggregation object](./api.html#model_Model.aggregate).
54+
In aggregate middleware, `this` refers to the [aggregation object](api.html#model_Model.aggregate).
5555

56-
* [aggregate](./api.html#model_Model.aggregate)
56+
* [aggregate](api.html#model_Model.aggregate)
5757

5858
Model middleware is supported for the following model functions.
5959
In model middleware functions, `this` refers to the model.
6060

61-
* [insertMany](./api.html#model_Model.insertMany)
61+
* [insertMany](api.html#model_Model.insertMany)
6262

6363
All middleware types support pre and post hooks.
6464
How pre and post hooks work is described in more detail below.
6565

6666
**Note:** If you specify `schema.pre('remove')`, Mongoose will register this
67-
middleware for [`doc.remove()`](./api.html#model_Model-remove) by default. If you
68-
want to your middleware to run on [`Query.remove()`](./api.html#query_Query-remove)
69-
use [`schema.pre('remove', { query: true, document: false }, fn)`](./api.html#schema_Schema-pre).
67+
middleware for [`doc.remove()`](api.html#model_Model-remove) by default. If you
68+
want to your middleware to run on [`Query.remove()`](api.html#query_Query-remove)
69+
use [`schema.pre('remove', { query: true, document: false }, fn)`](api.html#schema_Schema-pre).
7070

7171
**Note:** Unlike `schema.pre('remove')`, Mongoose registers `updateOne` and
7272
`deleteOne` middleware on `Query#updateOne()` and `Query#deleteOne()` by default.
@@ -75,7 +75,7 @@ This means that both `doc.updateOne()` and `Model.updateOne()` trigger
7575
`updateOne` or `deleteOne` middleware as document middleware, use
7676
`schema.pre('updateOne', { document: true, query: false })`.
7777

78-
**Note:** The [`create()`](./api.html#model_Model.create) function fires `save()` hooks.
78+
**Note:** The [`create()`](api.html#model_Model.create) function fires `save()` hooks.
7979

8080
<h3 id="pre"><a href="#pre">Pre</a></h3>
8181

@@ -482,7 +482,7 @@ pipeline from middleware.
482482

483483
Certain Mongoose hooks are synchronous, which means they do **not** support
484484
functions that return promises or receive a `next()` callback. Currently,
485-
only `init` hooks are synchronous, because the [`init()` function](./api.html#document_Document-init)
485+
only `init` hooks are synchronous, because the [`init()` function](api.html#document_Document-init)
486486
is synchronous. Below is an example of using pre and post init hooks.
487487

488488
```javascript

‎docs/models.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Models
22

3-
[Models](./api.html#model-js) are fancy constructors compiled from
3+
[Models](api.html#model-js) are fancy constructors compiled from
44
`Schema` definitions. An instance of a model is called a
5-
[document](./documents.html). Models are responsible for creating and
5+
[document](documents.html). Models are responsible for creating and
66
reading documents from the underlying MongoDB database.
77

88
* [Compiling your first model](#compiling)
@@ -33,7 +33,7 @@ before calling `.model()`!
3333

3434
### Constructing Documents
3535

36-
An instance of a model is called a [document](./documents.html). Creating
36+
An instance of a model is called a [document](documents.html). Creating
3737
them and saving to the database is easy.
3838

3939
```javascript
@@ -75,13 +75,13 @@ const Tank = connection.model('Tank', yourSchema);
7575

7676
### Querying
7777

78-
Finding documents is easy with Mongoose, which supports the [rich](http://www.mongodb.org/display/DOCS/Advanced+Queries) query syntax of MongoDB. Documents can be retreived using each `models` [find](./api.html#model_Model.find), [findById](./api.html#model_Model.findById), [findOne](./api.html#model_Model.findOne), or [where](./api.html#model_Model.where) static methods.
78+
Finding documents is easy with Mongoose, which supports the [rich](http://www.mongodb.org/display/DOCS/Advanced+Queries) query syntax of MongoDB. Documents can be retreived using each `models` [find](api.html#model_Model.find), [findById](api.html#model_Model.findById), [findOne](api.html#model_Model.findOne), or [where](api.html#model_Model.where) static methods.
7979

8080
```javascript
8181
Tank.find({ size: 'small' }).where('createdDate').gt(oneYearAgo).exec(callback);
8282
```
8383

84-
See the chapter on [queries](./queries.html) for more details on how to use the [Query](./api.html#query-js) api.
84+
See the chapter on [queries](queries.html) for more details on how to use the [Query](api.html#query-js) api.
8585

8686
### Deleting
8787

@@ -99,7 +99,7 @@ Tank.deleteOne({ size: 'large' }, function (err) {
9999

100100
Each `model` has its own `update` method for modifying documents in the
101101
database without returning them to your application. See the
102-
[API](./api.html#model_Model.updateOne) docs for more detail.
102+
[API](api.html#model_Model.updateOne) docs for more detail.
103103

104104
```javascript
105105
Tank.updateOne({ size: 'large' }, { name: 'T-90' }, function(err, res) {
@@ -109,7 +109,7 @@ Tank.updateOne({ size: 'large' }, { name: 'T-90' }, function(err, res) {
109109
```
110110

111111
_If you want to update a single document in the db and return it to your
112-
application, use [findOneAndUpdate](./api.html#model_Model.findOneAndUpdate)
112+
application, use [findOneAndUpdate](api.html#model_Model.findOneAndUpdate)
113113
instead._
114114

115115
### Change Streams
@@ -156,8 +156,8 @@ You can read more about [change streams in mongoose in this blog post](http://th
156156

157157
### Yet more
158158

159-
The [API docs](./api.html#model_Model) cover many additional methods available like [count](./api.html#model_Model.count), [mapReduce](./api.html#model_Model.mapReduce), [aggregate](./api.html#model_Model.aggregate), and [more](./api.html#model_Model.findOneAndRemove).
159+
The [API docs](api.html#model_Model) cover many additional methods available like [count](api.html#model_Model.count), [mapReduce](api.html#model_Model.mapReduce), [aggregate](api.html#model_Model.aggregate), and [more](api.html#model_Model.findOneAndRemove).
160160

161161
### Next Up
162162

163-
Now that we've covered `Models`, let's take a look at [Documents](/docs/documents.html).
163+
Now that we've covered `Models`, let's take a look at [Documents](/docs/documents.html).

‎docs/populate.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Story = mongoose.model('Story', storySchema);
2525
const Person = mongoose.model('Person', personSchema);
2626
```
2727

28-
So far we've created two [Models](./models.html). Our `Person` model has
28+
So far we've created two [Models](models.html). Our `Person` model has
2929
its `stories` field set to an array of `ObjectId`s. The `ref` option is
3030
what tells Mongoose which model to use during population, in our case
3131
the `Story` model. All `_id`s we store here must be document `_id`s from
@@ -105,7 +105,7 @@ is replaced with the mongoose document returned from the database by
105105
performing a separate query before returning the results.
106106

107107
Arrays of refs work the same way. Just call the
108-
[populate](./api.html#query_Query-populate) method on the query and an
108+
[populate](api.html#query_Query-populate) method on the query and an
109109
array of documents will be returned _in place_ of the original `_id`s.
110110

111111
<h3 id="setting-populated-fields"><a href="#setting-populated-fields">Setting Populated Fields</a></h3>
@@ -184,7 +184,7 @@ story.authors; // `[]`
184184

185185
What if we only want a few specific fields returned for the populated
186186
documents? This can be accomplished by passing the usual
187-
[field name syntax](./api.html#query_Query-select) as the second argument
187+
[field name syntax](api.html#query_Query-select) as the second argument
188188
to the populate method:
189189

190190
```javascript
@@ -367,18 +367,18 @@ Story.
367367
```
368368

369369
The documents returned from
370-
[query population](./api.html#query_Query-populate) become fully
370+
[query population](api.html#query_Query-populate) become fully
371371
functional, `remove`able, `save`able documents unless the
372-
[lean](./api.html#query_Query-lean) option is specified. Do not confuse
373-
them with [sub docs](./subdocs.html). Take caution when calling its
372+
[lean](api.html#query_Query-lean) option is specified. Do not confuse
373+
them with [sub docs](subdocs.html). Take caution when calling its
374374
remove method because you'll be removing it from the database, not just
375375
the array.
376376

377377
<h3 id="populate_an_existing_mongoose_document"><a href="#populate_an_existing_mongoose_document">Populating an existing document</a></h3>
378378

379379
If you have an existing mongoose document and want to populate some of its
380380
paths, you can use the
381-
[Document#populate()](./api.html#document_Document-populate) method.
381+
[Document#populate()](api.html#document_Document-populate) method.
382382
Just make sure you call [`Document#execPopulate()`](/docs/api/document.html#document_Document-execPopulate)
383383
to execute the `populate()`.
384384

@@ -406,8 +406,8 @@ person.populated('fans'); // Array of ObjectIds
406406
<h3 id="populate_multiple_documents"><a href="#populate_multiple_documents">Populating multiple existing documents</a></h3>
407407

408408
If we have one or many mongoose documents or even plain objects
409-
(_like [mapReduce](./api.html#model_Model.mapReduce) output_), we may
410-
populate them using the [Model.populate()](./api.html#model_Model.populate)
409+
(_like [mapReduce](api.html#model_Model.mapReduce) output_), we may
410+
populate them using the [Model.populate()](api.html#model_Model.populate)
411411
method. This is what `Document#populate()`
412412
and `Query#populate()` use to populate documents.
413413

‎docs/queries.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Queries
22

3-
Mongoose [models](./models.html) provide several static helper functions
3+
Mongoose [models](models.html) provide several static helper functions
44
for [CRUD operations](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete).
55
Each of these functions returns a
66
[mongoose `Query` object](http://mongoosejs.com/docs/api.html#Query).
@@ -55,7 +55,7 @@ Mongoose executed the query and passed the results to `callback`. All callbacks
5555
`callback(error, result)`. If an error occurs executing the query, the `error` parameter will contain an error document, and `result`
5656
will be null. If the query is successful, the `error` parameter will be null, and the `result` will be populated with the results of the query.
5757

58-
Anywhere a callback is passed to a query in Mongoose, the callback follows the pattern `callback(error, results)`. What `results` is depends on the operation: For `findOne()` it is a [potentially-null single document](./api.html#model_Model.findOne), `find()` a [list of documents](./api.html#model_Model.find), `count()` [the number of documents](./api.html#model_Model.count), `update()` the [number of documents affected](./api.html#model_Model.update), etc. The [API docs for Models](./api.html#model-js) provide more detail on what is passed to the callbacks.
58+
Anywhere a callback is passed to a query in Mongoose, the callback follows the pattern `callback(error, results)`. What `results` is depends on the operation: For `findOne()` it is a [potentially-null single document](api.html#model_Model.findOne), `find()` a [list of documents](api.html#model_Model.find), `count()` [the number of documents](api.html#model_Model.count), `update()` the [number of documents affected](api.html#model_Model.update), etc. The [API docs for Models](api.html#model-js) provide more detail on what is passed to the callbacks.
5959

6060
Now let's look at what happens when no `callback` is passed:
6161

@@ -75,7 +75,7 @@ query.exec(function (err, person) {
7575
});
7676
```
7777

78-
In the above code, the `query` variable is of type [Query](./api.html#query-js).
78+
In the above code, the `query` variable is of type [Query](api.html#query-js).
7979
A `Query` enables you to build up a query using chaining syntax, rather than specifying a JSON object.
8080
The below 2 examples are equivalent.
8181

@@ -105,7 +105,7 @@ Person.
105105
exec(callback);
106106
```
107107

108-
A full list of [Query helper functions can be found in the API docs](./api.html#query-js).
108+
A full list of [Query helper functions can be found in the API docs](api.html#query-js).
109109

110110
<h3 id="queries-are-not-promises">
111111
<a href="#queries-are-not-promises">
@@ -156,16 +156,16 @@ await BlogPost.updateOne({ title: 'Introduction to Promises' }, update, (err, re
156156
<h3 id="refs"><a href="#refs">References to other documents</a></h3>
157157

158158
There are no joins in MongoDB but sometimes we still want references to
159-
documents in other collections. This is where [population](./populate.html)
159+
documents in other collections. This is where [population](populate.html)
160160
comes in. Read more about how to include documents from other collections in
161-
your query results [here](./api.html#query_Query-populate).
161+
your query results [here](api.html#query_Query-populate).
162162

163163
<h3 id="streaming"><a href="#streaming">Streaming</a></h3>
164164

165165
You can [stream](http://nodejs.org/api/stream.html) query results from
166166
MongoDB. You need to call the
167-
[Query#cursor()](./api.html#query_Query-cursor) function to return an instance of
168-
[QueryCursor](./api.html#query_Query-cursor).
167+
[Query#cursor()](api.html#query_Query-cursor) function to return an instance of
168+
[QueryCursor](api.html#query_Query-cursor).
169169

170170
```javascript
171171
const cursor = Person.find({ occupation: /host/ }).cursor();

‎docs/schematypes.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<h2 id="schematypes"><a href="#schematypes">SchemaTypes</a></h2>
22

33
SchemaTypes handle definition of path
4-
[defaults](./api.html#schematype_SchemaType-default),
5-
[validation](./api.html#schematype_SchemaType-validate),
4+
[defaults](api.html#schematype_SchemaType-default),
5+
[validation](api.html#schematype_SchemaType-validate),
66
[getters](#getters),
7-
[setters](./api.html#schematype_SchemaType-set),
8-
[field selection defaults](./api.html#schematype_SchemaType-select) for
9-
[queries](./api.html#query-js),
7+
[setters](api.html#schematype_SchemaType-set),
8+
[field selection defaults](api.html#schematype_SchemaType-select) for
9+
[queries](api.html#query-js),
1010
and other general characteristics for Mongoose document properties.
1111

1212
<ul class="toc">
@@ -57,7 +57,7 @@ Check out [Mongoose's plugins search](http://plugins.mongoosejs.io) to find plug
5757
- [Mixed](#mixed)
5858
- [ObjectId](#objectids)
5959
- [Array](#arrays)
60-
- [Decimal128](./api.html#mongoose_Mongoose-Decimal128)
60+
- [Decimal128](api.html#mongoose_Mongoose-Decimal128)
6161
- [Map](#maps)
6262
- [Schema](#schemas)
6363

@@ -208,13 +208,13 @@ types.
208208

209209
<h5>All Schema Types</h5>
210210

211-
* `required`: boolean or function, if true adds a [required validator](./validation.html#built-in-validators) for this property
211+
* `required`: boolean or function, if true adds a [required validator](validation.html#built-in-validators) for this property
212212
* `default`: Any or function, sets a default value for the path. If the value is a function, the return value of the function is used as the default.
213213
* `select`: boolean, specifies default [projections](https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/) for queries
214-
* `validate`: function, adds a [validator function](./validation.html#built-in-validators) for this property
214+
* `validate`: function, adds a [validator function](validation.html#built-in-validators) for this property
215215
* `get`: function, defines a custom getter for this property using [`Object.defineProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty).
216216
* `set`: function, defines a custom setter for this property using [`Object.defineProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty).
217-
* `alias`: string, mongoose >= 4.10.0 only. Defines a [virtual](./guide.html#virtuals) with the given name that gets/sets this path.
217+
* `alias`: string, mongoose >= 4.10.0 only. Defines a [virtual](guide.html#virtuals) with the given name that gets/sets this path.
218218
* `immutable`: boolean, defines path as immutable. Mongoose prevents you from changing immutable paths unless the parent document has `isNew: true`.
219219
* `transform`: function, Mongoose calls this function when you call [`Document#toJSON()`](/docs/api/document.html#document_Document-toJSON) function, including when you [`JSON.stringify()`](https://thecodebarbarian.com/the-80-20-guide-to-json-stringify-in-javascript) a document.
220220

@@ -264,17 +264,17 @@ const schema2 = new Schema({
264264
* `lowercase`: boolean, whether to always call `.toLowerCase()` on the value
265265
* `uppercase`: boolean, whether to always call `.toUpperCase()` on the value
266266
* `trim`: boolean, whether to always call `.trim()` on the value
267-
* `match`: RegExp, creates a [validator](./validation.html) that checks if the value matches the given regular expression
268-
* `enum`: Array, creates a [validator](./validation.html) that checks if the value is in the given array.
269-
* `minLength`: Number, creates a [validator](./validation.html) that checks if the value length is not less than the given number
270-
* `maxLength`: Number, creates a [validator](./validation.html) that checks if the value length is not greater than the given number
267+
* `match`: RegExp, creates a [validator](validation.html) that checks if the value matches the given regular expression
268+
* `enum`: Array, creates a [validator](validation.html) that checks if the value is in the given array.
269+
* `minLength`: Number, creates a [validator](validation.html) that checks if the value length is not less than the given number
270+
* `maxLength`: Number, creates a [validator](validation.html) that checks if the value length is not greater than the given number
271271
* `populate`: Object, sets default [populate options](/docs/populate.html#query-conditions)
272272

273273
<h5 id="number-validators">Number</h5>
274274

275-
* `min`: Number, creates a [validator](./validation.html) that checks if the value is greater than or equal to the given minimum.
276-
* `max`: Number, creates a [validator](./validation.html) that checks if the value is less than or equal to the given maximum.
277-
* `enum`: Array, creates a [validator](./validation.html) that checks if the value is strictly equal to one of the values in the given array.
275+
* `min`: Number, creates a [validator](validation.html) that checks if the value is greater than or equal to the given minimum.
276+
* `max`: Number, creates a [validator](validation.html) that checks if the value is less than or equal to the given maximum.
277+
* `enum`: Array, creates a [validator](validation.html) that checks if the value is strictly equal to one of the values in the given array.
278278
* `populate`: Object, sets default [populate options](/docs/populate.html#query-conditions)
279279

280280
<h5>Date</h5>
@@ -408,7 +408,7 @@ like, but Mongoose loses the ability to auto detect and save those changes.
408408
To tell Mongoose that the value of a Mixed type has changed, you need to
409409
call `doc.markModified(path)`, passing the path to the Mixed type you just changed.
410410

411-
To avoid these side-effects, a [Subdocument](./subdocs.html) path may be used
411+
To avoid these side-effects, a [Subdocument](subdocs.html) path may be used
412412
instead.
413413

414414
```javascript
@@ -480,8 +480,8 @@ console.log(new M({ b: 'nay' }).b); // false
480480

481481
<h4 id="arrays">Arrays</h4>
482482

483-
Mongoose supports arrays of [SchemaTypes](./api.html#schema_Schema.Types)
484-
and arrays of [subdocuments](./subdocs.html). Arrays of SchemaTypes are
483+
Mongoose supports arrays of [SchemaTypes](api.html#schema_Schema.Types)
484+
and arrays of [subdocuments](subdocs.html). Arrays of SchemaTypes are
485485
also called _primitive arrays_, and arrays of subdocuments are also called
486486
_document arrays_.
487487

@@ -676,7 +676,7 @@ schema.path('arr.0.url').get(v => `${root}${v}`);
676676

677677
<h3 id="schemas"><a href="#schemas">Schemas</a></h3>
678678

679-
To declare a path as another [schema](./guide.html#definition),
679+
To declare a path as another [schema](guide.html#definition),
680680
set `type` to the sub-schema's instance.
681681

682682
To set a default value based on the sub-schema's shape, simply set a default value,

‎docs/subdocs.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ a group of fields (e.g. dateRange.fromDate <= dateRange.toDate).
3636
### What is a Subdocument?
3737

3838
Subdocuments are similar to normal documents. Nested schemas can have
39-
[middleware](./middleware.html), [custom validation logic](./validation.html),
39+
[middleware](middleware.html), [custom validation logic](validation.html),
4040
virtuals, and any other feature top-level schemas can use. The major
4141
difference is that subdocuments are
4242
not saved individually, they are saved whenever their top-level parent
@@ -53,7 +53,7 @@ parent.children[0].name = 'Matthew';
5353
parent.save(callback);
5454
```
5555

56-
Subdocuments have `save` and `validate` [middleware](./middleware.html)
56+
Subdocuments have `save` and `validate` [middleware](middleware.html)
5757
just like top-level documents. Calling `save()` on the parent document triggers
5858
the `save()` middleware for all its subdocuments, and the same for `validate()`
5959
middleware.
@@ -222,7 +222,7 @@ doc.child; // { age: 0 }
222222
### Finding a Subdocument
223223

224224
Each subdocument has an `_id` by default. Mongoose document arrays have a
225-
special [id](./api.html#types_documentarray_MongooseDocumentArray-id) method
225+
special [id](api.html#types_documentarray_MongooseDocumentArray-id) method
226226
for searching a document array to find a document with a given `_id`.
227227
```javascript
228228
const doc = parent.children.id(_id);
@@ -231,9 +231,9 @@ const doc = parent.children.id(_id);
231231
### Adding Subdocs to Arrays
232232

233233
MongooseArray methods such as
234-
[push](./api.html#mongoosearray_MongooseArray-push),
235-
[unshift](./api.html#mongoosearray_MongooseArray-unshift),
236-
[addToSet](./api.html#mongoosearray_MongooseArray-addToSet),
234+
[push](api.html#mongoosearray_MongooseArray-push),
235+
[unshift](api.html#mongoosearray_MongooseArray-unshift),
236+
[addToSet](api.html#mongoosearray_MongooseArray-addToSet),
237237
and others cast arguments to their proper types transparently:
238238
```javascript
239239
const Parent = mongoose.model('Parent');
@@ -252,7 +252,7 @@ parent.save(function (err) {
252252
```
253253

254254
Subdocs may also be created without adding them to the array by using the
255-
[create](./api.html#types_documentarray_MongooseDocumentArray.create)
255+
[create](api.html#types_documentarray_MongooseDocumentArray.create)
256256
method of MongooseArrays.
257257

258258
```javascript
@@ -262,7 +262,7 @@ const newdoc = parent.children.create({ name: 'Aaron' });
262262
### Removing Subdocs
263263

264264
Each subdocument has it's own
265-
[remove](./api.html#types_embedded_EmbeddedDocument-remove) method. For
265+
[remove](api.html#types_embedded_EmbeddedDocument-remove) method. For
266266
an array subdocument, this is equivalent to calling `.pull()` on the
267267
subdocument. For a single nested subdocument, `remove()` is equivalent
268268
to setting the subdocument to `null`.
@@ -389,4 +389,4 @@ const schema = new Schema({
389389
### Next Up
390390

391391
Now that we've covered Subdocuments, let's take a look at
392-
[querying](./queries.html).
392+
[querying](queries.html).

‎docs/validation.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
Before we get into the specifics of validation syntax, please keep the following rules in mind:
44

5-
- Validation is defined in the [SchemaType](./schematypes.html)
6-
- Validation is [middleware](./middleware.html). Mongoose registers validation as a `pre('save')` hook on every schema by default.
7-
- You can disable automatic validation before save by setting the [validateBeforeSave](./guide.html#validateBeforeSave) option
5+
- Validation is defined in the [SchemaType](schematypes.html)
6+
- Validation is [middleware](middleware.html). Mongoose registers validation as a `pre('save')` hook on every schema by default.
7+
- You can disable automatic validation before save by setting the [validateBeforeSave](guide.html#validateBeforeSave) option
88
- You can manually run validation using `doc.validate(callback)` or `doc.validateSync()`
9-
- You can manually mark a field as invalid (causing validation to fail) by using [`doc.invalidate(...)`](./api.html#document_Document-invalidate)
10-
- Validators are not run on undefined values. The only exception is the [`required` validator](./api.html#schematype_SchemaType-required).
11-
- Validation is asynchronously recursive; when you call [Model#save](./api.html#model_Model-save), sub-document validation is executed as well. If an error occurs, your [Model#save](./api.html#model_Model-save) callback receives it
9+
- You can manually mark a field as invalid (causing validation to fail) by using [`doc.invalidate(...)`](api.html#document_Document-invalidate)
10+
- Validators are not run on undefined values. The only exception is the [`required` validator](api.html#schematype_SchemaType-required).
11+
- Validation is asynchronously recursive; when you call [Model#save](api.html#model_Model-save), sub-document validation is executed as well. If an error occurs, your [Model#save](api.html#model_Model-save) callback receives it
1212
- Validation is customizable
1313

1414
```javascript
@@ -19,9 +19,9 @@ Before we get into the specifics of validation syntax, please keep the following
1919

2020
Mongoose has several built-in validators.
2121

22-
- All [SchemaTypes](./schematypes.html) have the built-in [required](./api.html#schematype_SchemaType-required) validator. The required validator uses the [SchemaType's `checkRequired()` function](./api.html#schematype_SchemaType-checkRequired) to determine if the value satisfies the required validator.
23-
- [Numbers](./api.html#schema-number-js) have [`min` and `max`](./schematypes.html#number-validators) validators.
24-
- [Strings](./api.html#schema-string-js) have [`enum`, `match`, `minLength`, and `maxLength`](./schematypes.html#string-validators) validators.
22+
- All [SchemaTypes](schematypes.html) have the built-in [required](api.html#schematype_SchemaType-required) validator. The required validator uses the [SchemaType's `checkRequired()` function](api.html#schematype_SchemaType-checkRequired) to determine if the value satisfies the required validator.
23+
- [Numbers](api.html#schema-number-js) have [`min` and `max`](schematypes.html#number-validators) validators.
24+
- [Strings](api.html#schema-string-js) have [`enum`, `match`, `minLength`, and `maxLength`](schematypes.html#string-validators) validators.
2525

2626
Each of the validator links above provide more information about how to enable them and customize their error messages.
2727

@@ -61,7 +61,7 @@ to suit your needs.
6161

6262
Custom validation is declared by passing a validation function.
6363
You can find detailed instructions on how to do this in the
64-
[`SchemaType#validate()` API docs](./api.html#schematype_SchemaType-validate).
64+
[`SchemaType#validate()` API docs](api.html#schematype_SchemaType-validate).
6565

6666
```javascript
6767
[require:Custom Validators]
@@ -82,7 +82,7 @@ the value `false`, Mongoose will consider that a validation error.
8282

8383
Errors returned after failed validation contain an `errors` object
8484
whose values are `ValidatorError` objects. Each
85-
[ValidatorError](./api.html#error-validation-js) has `kind`, `path`,
85+
[ValidatorError](api.html#error-validation-js) has `kind`, `path`,
8686
`value`, and `message` properties.
8787
A ValidatorError also may have a `reason` property. If an error was
8888
thrown in the validator, this property will contain the error that was
@@ -192,4 +192,4 @@ of the array.
192192

193193
```javascript
194194
[require:Update Validators Only Run For Some Operations]
195-
```
195+
```

0 commit comments

Comments
 (0)
Please sign in to comment.