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

docs(faq): remove faq ipv6 #9004

Merged
merged 2 commits into from
May 15, 2020
Merged
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
29 changes: 16 additions & 13 deletions docs/faq.pug
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ block content
<a href="#native_link#"><span class="sponsor">Sponsor</span> #native_company# — #native_desc#</a>
</div>


<hr id="array-changes-not-saved" />

<a href="#array-changes-not-saved">**Q**</a>. Why don't my changes to arrays get saved when I update an element
Expand Down Expand Up @@ -72,6 +73,7 @@ block content
doc.save();
```


<hr id="unique-doesnt-work" />

<a href="#unique-doesnt-work">**Q**</a>. I declared a schema property as `unique` but I can still save
Expand Down Expand Up @@ -124,6 +126,7 @@ block content
rather than relying on mongoose to do it for you. The `unique` option for schemas is
convenient for development and documentation, but mongoose is *not* an index management solution.


<hr id="nested-properties" />

<a href="#nested-properties">**Q**</a>. When I have a nested property in a schema, mongoose adds empty objects by default. Why?
Expand Down Expand Up @@ -154,6 +157,7 @@ block content
must always be defined as an object on a mongoose document, even if `nested`
is undefined on the underlying [POJO](./guide.html#minimize).


<hr id="destructured-imports" />

<a href="#destructured-imports">**Q**</a>. When I use named imports like `import { set } from 'mongoose'`, I
Expand All @@ -179,6 +183,7 @@ block content
foo(); // "undefined"
```


<hr id="arrow-functions" />

<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.
Expand Down Expand Up @@ -209,6 +214,7 @@ block content
});
```


<hr id="type-key">

<a href="#type-key">**Q**</a>. I have an embedded property named `type` like this:
Expand Down Expand Up @@ -253,6 +259,7 @@ block content
});
```


<hr id="populate_sort_order" />

<a href="#populate_sort_order">**Q**</a>. I'm populating a nested property under an array like the below code:
Expand All @@ -278,6 +285,7 @@ block content
connect to MongoDB. Read the [buffering section of the connection docs](./connections.html#buffering)
for more information.


<hr id="enable_debugging" />

<a href="#enable_debugging">**Q**</a>. How can I enable debugging?
Expand All @@ -294,6 +302,7 @@ block content
All executed collection methods will log output of their arguments to your
console.


<hr id="callback_never_executes" />

<a href="#callback_never_executes">**Q**</a>. My `save()` callback never executes. What am I doing wrong?
Expand All @@ -319,13 +328,15 @@ block content
mongoose.set('bufferCommands', false);
```


<hr id="creating_connections" />

<a href="#creating_connections">**Q**</a>. Should I create/destroy a new connection for each database operation?

**A**. No. Open your connection when your application starts up and leave
it open until the application shuts down.


<hr id="overwrite-model-error" />

<a href="#overwrite-model-error">**Q**</a>. Why do I get "OverwriteModelError: Cannot overwrite .. model once
Expand All @@ -351,6 +362,7 @@ block content
var Kitten = connection.model('Kitten', kittySchema);
```


<hr id="array-defaults" />

<a href="#array-defaults">**Q**</a>. How can I change mongoose's default behavior of initializing an array
Expand All @@ -365,6 +377,8 @@ block content
}
});
```


<hr id="initialize-array-path-null" />

<a href="#initialize-array-path-null">**Q**</a>. How can I initialize an array path to `null`?
Expand All @@ -389,6 +403,7 @@ block content
to query by date using the aggregation framework, you're responsible for ensuring
that you're passing in a valid date.


<hr id="date_changes" />

<a href="#date_changes">**Q**</a>. Why don't in-place modifications to date objects
Expand Down Expand Up @@ -429,19 +444,6 @@ block content
**A**. Technically, any 12 character string is a valid [ObjectId](https://docs.mongodb.com/manual/reference/bson-types/#objectid).
Consider using a regex like `/^[a-f0-9]{24}$/` to test whether a string is exactly 24 hex characters.

<hr id="slow-localhost" />

<a href="#slow-localhost">**Q**</a>. I'm connecting to `localhost` and it takes me nearly 1 second to connect. How do I fix this?

**A**. The underlying MongoDB driver defaults to looking for IPv6 addresses, so the most likely cause is that your `localhost` DNS mapping isn't configured to handle IPv6. Use `127.0.0.1` instead of `localhost` or use the `family` option as shown in the [connection docs](https://mongoosejs.com/docs/connections.html#options).

```javascript
// One alternative is to bypass 'localhost'
mongoose.connect('mongodb://127.0.0.1:27017/test');
// Another option is to specify the `family` option, which tells the
// MongoDB driver to only look for IPv4 addresses rather than IPv6 first.
mongoose.connect('mongodb://localhost:27017/test', { family: 4 });
```

<hr id="map-keys-strings" />

Expand All @@ -458,6 +460,7 @@ block content
[perDocumentLimit](/docs/populate.html#limit-vs-perDocumentLimit) option (new in Mongoose 5.9.0). Just keep in
mind that populate() will execute a separate query for each document.


<hr id="add_something" />

**Something to add?**
Expand Down