Skip to content

Commit

Permalink
docs: backport static links to relative
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Nov 14, 2022
1 parent 1a2d7f8 commit 9ca46d1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/deprecations.md
Expand Up @@ -101,7 +101,7 @@ behavior until Mongoose 6.0.

<h2 id="ensureindex"><a href="#ensureindex"><code>ensureIndex()</code></a></h2>

If you define [indexes in your Mongoose schemas](https://mongoosejs.com/docs/guide.html#indexes), you'll see the below
If you define [indexes in your Mongoose schemas](guide.html#indexes), you'll see the below
deprecation warning.

```
Expand Down Expand Up @@ -290,4 +290,4 @@ const writeStream = gfs.createWriteStream({ filename: 'test.dat' });
const conn = mongoose.createConnection('mongodb://localhost:27017/gfstest');
const gridFSBucket = new mongoose.mongo.GridFSBucket(conn.db);
const writeStream = gridFSBucket.openUploadStream('test.dat');
```
```
4 changes: 2 additions & 2 deletions docs/jest.md
Expand Up @@ -8,7 +8,7 @@ If you choose to delve into dangerous waters and test Mongoose apps with Jest, h

<h2 id="recommended-testenvironment"><a href="#recommended-testenvironment">Recommended <code>testEnvironment</code></a></h2>

If you are using Jest `<=26`, do **not** use Jest's default [`jsdom` test environment](https://jestjs.io/docs/en/configuration.html#testenvironment-string) when testing Mongoose apps, _unless_ you are explicitly testing an application that only uses [Mongoose's browser library](https://mongoosejs.com/docs/browser.html). In Jest `>=27`, ["node" is Jest's default `testEnvironment`](https://jestjs.io/ro/blog/2021/05/25/jest-27#flipping-defaults), so this is no longer an issue.
If you are using Jest `<=26`, do **not** use Jest's default [`jsdom` test environment](https://jestjs.io/docs/en/configuration.html#testenvironment-string) when testing Mongoose apps, _unless_ you are explicitly testing an application that only uses [Mongoose's browser library](browser.html). In Jest `>=27`, ["node" is Jest's default `testEnvironment`](https://jestjs.io/ro/blog/2021/05/25/jest-27#flipping-defaults), so this is no longer an issue.

The `jsdom` test environment attempts to create a browser-like test
environment in Node.js, and it comes with numerous nasty surprises like a
Expand Down Expand Up @@ -81,4 +81,4 @@ course on Pluralsight has a great section on testing Mongoose apps with [Mocha](

<a href="https://pluralsight.pxf.io/c/1321469/424552/7490?u=https%3A%2F%2Fapp.pluralsight.com%2Flibrary%2Fcourses%2Fnode-js-express-rest-web-services%2Ftable-of-contents">
<img src="https://i.imgur.com/KouuaAZ.png">
</a>
</a>
4 changes: 2 additions & 2 deletions docs/promises.md
Expand Up @@ -7,7 +7,7 @@ This means that you can do things like `MyModel.findOne({}).then()` and
`await MyModel.findOne({}).exec()` if you're using
[async/await](http://thecodebarbarian.com/80-20-guide-to-async-await-in-node.js.html).

You can find the return type of specific operations [in the api docs](https://mongoosejs.com/docs/api.html)
You can find the return type of specific operations [in the api docs](api.html)
You can also read more about [promises in Mongoose](https://masteringjs.io/tutorials/mongoose/promise).

```javascript
Expand Down Expand Up @@ -72,4 +72,4 @@ ES6-style promise constructor and mongoose will use it.
<br><br>
<a href="http://asyncawait.net/?utm_source=mongoosejs&utm_campaign=promises" style="margin-left: 100px">
<img src="/docs/images/asyncawait.png" style="width: 650px" />
</a>
</a>
2 changes: 1 addition & 1 deletion docs/queries.md
Expand Up @@ -200,7 +200,7 @@ of inactivity. You can read more about working around session idle timeouts in t

<h3 id="versus-aggregation"><a href="#versus-aggregation">Versus Aggregation</a></h3>

[Aggregation](https://mongoosejs.com/docs/api.html#aggregate_Aggregate) can
[Aggregation](api.html#aggregate_Aggregate) can
do many of the same things that queries can. For example, below is
how you can use `aggregate()` to find docs where `name.last = 'Ghost'`:

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/custom-casting.md
@@ -1,6 +1,6 @@
# Custom Casting

[Mongoose 5.4.0](https://github.com/Automattic/mongoose/blob/master/History.md#540--2018-12-14) introduced [several ways to configure SchemaTypes globally](http://thecodebarbarian.com/whats-new-in-mongoose-54-global-schematype-configuration). One of these new features is the [`SchemaType.cast()` function](https://mongoosejs.com/docs/api.html#schematype_SchemaType-cast), which enables you to override Mongoose's built-in casting.
[Mongoose 5.4.0](https://github.com/Automattic/mongoose/blob/master/History.md#540--2018-12-14) introduced [several ways to configure SchemaTypes globally](http://thecodebarbarian.com/whats-new-in-mongoose-54-global-schematype-configuration). One of these new features is the [`SchemaType.cast()` function](../api.html#schematype_SchemaType-cast), which enables you to override Mongoose's built-in casting.

For example, by default Mongoose will throw an error if you attempt to cast
a string that contains a Japanese numeral to a number.
Expand All @@ -14,4 +14,4 @@ the string that contains the Japanese numeral "2" to a number as shown below.

```javascript
[require:custom casting.*casting override]
```
```
4 changes: 2 additions & 2 deletions docs/tutorials/getters-setters.md
Expand Up @@ -26,7 +26,7 @@ app.get(function(req, res) {
});
```

To disable running getters when converting a document to JSON, set the [`toJSON.getters` option to `false` in your schema](https://mongoosejs.com/docs/guide.html#toJSON) as shown below.
To disable running getters when converting a document to JSON, set the [`toJSON.getters` option to `false` in your schema](../guide.html#toJSON) as shown below.

```javascript
const userSchema = new Schema({
Expand Down Expand Up @@ -80,4 +80,4 @@ corresponding getter for `email`.

```javascript
[require:getters/setters.*setters.*vs ES6]
```
```
8 changes: 4 additions & 4 deletions docs/tutorials/query_casting.md
@@ -1,12 +1,12 @@
# Query Casting

The first parameter to [`Model.find()`](https://mongoosejs.com/docs/api.html#model_Model.find), [`Query#find()`](https://mongoosejs.com/docs/api.html#query_Query-find), [`Model.findOne()`](https://mongoosejs.com/docs/api.html#model_Model.findOne), etc. is called `filter`. In older content this parameter is sometimes called `query` or `conditions`. For example:
The first parameter to [`Model.find()`](../api.html#model_Model.find), [`Query#find()`](../api.html#query_Query-find), [`Model.findOne()`](../api.html#model_Model.findOne), etc. is called `filter`. In older content this parameter is sometimes called `query` or `conditions`. For example:

```javascript
[require:Cast Tutorial.*get and set]
```

When you execute the query using [`Query#exec()`](https://mongoosejs.com/docs/api.html#query_Query-exec) or [`Query#then()`](https://mongoosejs.com/docs/api.html#query_Query-then), Mongoose _casts_ the filter to match your schema.
When you execute the query using [`Query#exec()`](../api.html#query_Query-exec) or [`Query#then()`](../api.html#query_Query-then), Mongoose _casts_ the filter to match your schema.

```javascript
[require:Cast Tutorial.*cast values]
Expand All @@ -27,7 +27,7 @@ By default, Mongoose does **not** cast filter properties that aren't in your sch
[require:Cast Tutorial.*not in schema]
```

You can configure this behavior using the [`strictQuery` option for schemas](https://mongoosejs.com/docs/guide.html#strictQuery). This option is analogous to the [`strict` option](https://mongoosejs.com/docs/guide.html#strict). Setting `strictQuery` to `true` removes non-schema properties from the filter:
You can configure this behavior using the [`strictQuery` option for schemas](../guide.html#strictQuery). This option is analogous to the [`strict` option](../guide.html#strict). Setting `strictQuery` to `true` removes non-schema properties from the filter:

```javascript
[require:Cast Tutorial.*strictQuery true]
Expand All @@ -46,4 +46,4 @@ Because of schemas, Mongoose knows what types fields should be, so it can provid

```javascript
[require:Cast Tutorial.*implicit in]
```
```

0 comments on commit 9ca46d1

Please sign in to comment.