Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update & remove old links #13019

Merged
merged 12 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ exceptions that are explained below.
Below are some of the options that are important for tuning Mongoose.

* `promiseLibrary` - Sets the [underlying driver's promise library](http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html).
* `maxPoolSize` - The maximum number of sockets the MongoDB driver will keep open for this connection. By default, `maxPoolSize` is 100. Keep in mind that 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). You may want to decrease `maxPoolSize` if you are running into [connection limits](https://www.mongodb.com/docs/atlas/atlas-limits/#connection-limits-and-cluster-tier).
* `maxPoolSize` - The maximum number of sockets the MongoDB driver will keep open for this connection. By default, `maxPoolSize` is 100. Keep in mind that 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). You may want to decrease `maxPoolSize` if you are running into [connection limits](https://www.mongodb.com/docs/atlas/reference/atlas-limits/#connection-limits-and-cluster-tier).
* `minPoolSize` - The minimum number of sockets the MongoDB driver will keep open for this connection. The MongoDB driver may close sockets that have been inactive for some time. You may want to increase `minPoolSize` if you expect your app to go through long idle times and want to make sure your sockets stay open to avoid slow trains when activity picks up.
* `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.
* `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 })`
Expand Down Expand Up @@ -253,7 +253,7 @@ For long running applications, it is often prudent to enable `keepAlive`
with a number of milliseconds. Without it, after some period of time
you may start to see `"connection closed"` errors for what seems like
no reason. If so, after
[reading this](http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html),
[reading this](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html),
you may decide to enable `keepAlive`:

```javascript
Expand Down
9 changes: 4 additions & 5 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ If you want to add additional keys later, use the
Each key in our code `blogSchema` defines a property in our documents which
will be cast to its associated [SchemaType](api/schematype.html#schematype_SchemaType).
For example, we've defined a property `title` which will be cast to the
[String](api/schema-string-js.html#schema-string-js) SchemaType and property `date`
[String](schematypes.html#strings) SchemaType and property `date`
which will be cast to a `Date` SchemaType.

Notice above that if a property only requires a type, it can be specified using
Expand Down Expand Up @@ -588,8 +588,7 @@ new Schema({..}, { capped: 1024 });
```

The `capped` option may also be set to an object if you want to pass
additional options like [max](https://www.mongodb.com/docs/manual/core/capped-collections/#change-the-maximum-number-of-documents-in-a-capped-collection)
or [autoIndexId](http://www.mongodb.org/display/DOCS/Capped+Collections#CappedCollections-autoIndexId).
additional options like [max](https://www.mongodb.com/docs/manual/core/capped-collections/#change-the-maximum-number-of-documents-in-a-capped-collection).
In this case you must explicitly pass the `size` option, which is required.

```javascript
Expand All @@ -599,7 +598,7 @@ new Schema({..}, { capped: { size: 1024, max: 1000, autoIndexId: true } });
<h3 id="collection"><a href="#collection">option: collection</a></h3>

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

Expand Down Expand Up @@ -1192,7 +1191,7 @@ thing.save(); // version is not incremented
<h3 id="timestamps"><a href="#timestamps">option: timestamps</a></h3>

The `timestamps` option tells Mongoose to assign `createdAt` and `updatedAt` fields
to your schema. The type assigned is [Date](api/schema-date-js.html#schema-date-js).
to your schema. The type assigned is [Date](schematypes.html#dates).

By default, the names of the fields are `createdAt` and `updatedAt`. Customize
the field names by setting `timestamps.createdAt` and `timestamps.updatedAt`.
Expand Down
2 changes: 1 addition & 1 deletion docs/migrating_to_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const cursorWithOptions = MyModel.
geoNear
</a></h3>

`Model.geoNear()` has been removed because the [MongoDB driver no longer supports it](https://github.com/mongodb/node-mongodb-native/blob/master/CHANGES_3.0.0.md#geonear-command-helper)
`Model.geoNear()` has been removed because the [MongoDB driver no longer supports it](https://github.com/mongodb/node-mongodb-native/blob/4bac63ce7b9e9fff87c31c5a27d78bcdaca12669/etc/notes/CHANGES_3.0.0.md#geonear-command-helper)

<h3 id="uri-encoding"><a href="#uri-encoding">
Required URI encoding of connection strings
Expand Down
4 changes: 2 additions & 2 deletions docs/models.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Models

[Models](api/model-js.html#model-js) are fancy constructors compiled from
[Models](api/model.html) are fancy constructors compiled from
`Schema` definitions. An instance of a model is called a
[document](documents.html). Models are responsible for creating and
reading documents from the underlying MongoDB database.
Expand Down Expand Up @@ -83,7 +83,7 @@ Documents can be retrieved using a `model`'s [find](api/model.html#model_Model-f
Tank.find({ size: 'small' }).where('createdDate').gt(oneYearAgo).exec(callback);
```

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

## Deleting

Expand Down
4 changes: 2 additions & 2 deletions docs/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ query.exec(function (err, person) {
});
```

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

Expand Down Expand Up @@ -107,7 +107,7 @@ Person.
exec(callback);
```

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

<h3 id="queries-are-not-promises">
<a href="#queries-are-not-promises">
Expand Down
2 changes: 1 addition & 1 deletion docs/schematypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SchemaTypes handle definition of path
[getters](#getters),
[setters](api/schematype.html#schematype_SchemaType-set),
[field selection defaults](api/schematype.html#schematype_SchemaType-select) for
[queries](api/query-js.html#query-js),
[queries](api/query.html),
and other general characteristics for Mongoose document properties.

* [What is a SchemaType?](#what-is-a-schematype)
Expand Down
7 changes: 2 additions & 5 deletions docs/subdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,8 @@ const doc = parent.children.id(_id);

### Adding Subdocs to Arrays

MongooseArray methods such as
[push](api/mongoosearray.html#mongoosearray_MongooseArray-push),
[unshift](api/mongoosearray.html#mongoosearray_MongooseArray-unshift),
[addToSet](api/mongoosearray.html#mongoosearray_MongooseArray-addToSet),
and others cast arguments to their proper types transparently:
MongooseArray methods such as `push`, `unshift`, `addToSet`, and others cast arguments to their proper types transparently:

```javascript
const Parent = mongoose.model('Parent');
const parent = new Parent();
Expand Down
3 changes: 1 addition & 2 deletions docs/tutorials/ssl.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ MongooseServerSelectionError: unable to verify the first certificate
```

This error is often caused by [self-signed MongoDB certificates](https://medium.com/@rajanmaharjan/secure-your-mongodb-connections-ssl-tls-92e2addb3c89) or other situations where the certificate sent by the MongoDB
server is not registered with an established certificate authority. The solution is to set the `sslCA` option, which
[essentially sets a list of allowed SSL certificates](https://mongodb.github.io/node-mongodb-native/2.1/tutorials/connect/ssl/).
server is not registered with an established certificate authority. The solution is to set the `sslCA` option, which essentially sets a list of allowed SSL certificates.

```javascript
await mongoose.connect('mongodb://127.0.0.1:27017/test', {
Expand Down
7 changes: 3 additions & 4 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ Query.prototype.skip = function skip(v) {
* @memberOf Query
* @instance
* @param {Number} val
* @see maxScan https://www.mongodb.com/docs/manual/reference/operator/maxScan/
* @see maxScan https://www.mongodb.com/docs/v4.0/reference/method/cursor.maxScan/
* @api public
*/

Expand Down Expand Up @@ -978,7 +978,6 @@ Query.prototype.skip = function skip(v) {
* @method snapshot
* @memberOf Query
* @instance
* @see snapshot https://www.mongodb.com/docs/manual/reference/operator/snapshot/
* @return {Query} this
* @api public
*/
Expand Down Expand Up @@ -1563,8 +1562,8 @@ Query.prototype.getOptions = function() {
* - [readPreference](https://www.mongodb.com/docs/manual/applications/replication/#read-preference)
* - [hint](https://www.mongodb.com/docs/manual/reference/method/cursor.hint/)
* - [comment](https://www.mongodb.com/docs/manual/reference/method/cursor.comment/)
* - [snapshot](https://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsnapshot%28%29%7D%7D)
* - [maxscan](https://docs.mongodb.org/v3.2/reference/operator/meta/maxScan/#metaOp._S_maxScan)
* - snapshot
* - [maxscan](https://www.mongodb.com/docs/v4.0/reference/method/cursor.maxScan/)
*
* The following options are only for write operations: `update()`, `updateOne()`, `updateMany()`, `replaceOne()`, `findOneAndUpdate()`, and `findByIdAndUpdate()`:
*
Expand Down