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

Backport some documentation changes into 6.x #13091

Merged
merged 5 commits into from
Feb 27, 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
8 changes: 8 additions & 0 deletions docs/migrating_to_6.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ If you're still on Mongoose 4.x, please read the [Mongoose 4.x to 5.x migration
* [No default model for `Query.prototype.populate()`](#no-default-model-for-query-prototype-populate)
* [`toObject()` and `toJSON()` Use Nested Schema `minimize`](#toobject-and-tojson-use-nested-schema-minimize)
* [TypeScript changes](#typescript-changes)
* [Removed `reconnectTries` and `reconnectInterval` options](#removed-reconnecttries-and-reconnectinterval-options)

<h3 id="version-requirements"><a href="#version-requirements">Version Requirements</a></h3>

Expand Down Expand Up @@ -530,3 +531,10 @@ schema.virtual('myVirtual').get(function() {
this.name; // string
});
```

<h3 id="removed-reconnecttries-and-reconnectinterval-options"><a href="#removed-reconnecttries-and-reconnectinterval-options">Removed <code>reconnectTries</code> and <code>reconnectInterval</code> options</a></h3>

The `reconnectTries` and `reconnectInterval` options have been removed since they are no longer necessary.

The MongoDB node driver will always attempt to retry any operation for up to `serverSelectionTimeoutMS`, even if MongoDB is down for a long period of time.
So, it will never run out of retries or try to reconnect to MongoDB.
10 changes: 5 additions & 5 deletions docs/populate.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ user and have a good reason for doing so.
<li><a href="#field-selection">Field Selection</a></li>
<li><a href="#populating-multiple-paths">Populating Multiple Paths</a></li>
<li><a href="#query-conditions">Query conditions and other options</a></li>
<li><a href="#limit-vs-perDocumentLimit"><code>limit</code> vs. <code>perDocumentLimit</code></a></li>
<li><a href="#refs-to-children">Refs to children</a></li>
<li><a href="#populate_an_existing_mongoose_document">Populating an existing document</a></li>
<li><a href="#populate_multiple_documents">Populating multiple existing documents</a></li>
<li><a href="#deep-populate">Populating across multiple levels</a></li>
<li><a href="#cross-db-populate">Populating across Databases</a></li>
<li><a href="#dynamic-ref">Dynamic References via `refPath`</a></li>
<li><a href="#dynamic-ref">Dynamic References via <code>refPath</code></a></li>
<li><a href="#populate-virtuals">Populate Virtuals</a></li>
<li><a href="#count">Populate Virtuals: The Count Option</a></li>
<li><a href="#match">Populate Virtuals: The Match Option</a></li>
Expand Down Expand Up @@ -275,7 +276,7 @@ story; // null

If you want to filter stories by their author's name, you should use [denormalization](https://www.mongodb.com/blog/post/6-rules-of-thumb-for-mongodb-schema-design-part-3).

<h3 id="limit-vs-perDocumentLimit"><a href="#limit-vs-perDocumentLimit">limit vs. perDocumentLimit</a></h3>
<h3 id="limit-vs-perDocumentLimit"><a href="#limit-vs-perDocumentLimit"><code>limit</code> vs. <code>perDocumentLimit</code></a></h3>

Populate does support a `limit` option, however, it currently
does **not** limit on a per-document basis for backwards compatibility. For example,
Expand Down Expand Up @@ -485,9 +486,8 @@ const events = await Event.
populate({ path: 'conversation', model: Conversation });
```

<h3 id="dynamic-ref"><a href="#dynamic-ref">Dynamic References via `refPath`</a></h3>

Mongoose can also populate from multiple collections based on the value
<h3 id="dynamic-ref"><a href="#dynamic-ref">Dynamic References via <code>refPath</code></a></h3>
<code>
of a property in the document. Let's say you're building a schema for
storing comments. A user may comment on either a blog post or a product.

Expand Down
2 changes: 1 addition & 1 deletion lib/schematype.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ SchemaType.prototype.validators;
* @memberOf SchemaType
*/

SchemaType.prototype.validators;
SchemaType.prototype.isRequired;

/**
* Split the current dottet path into segments
Expand Down