Skip to content

Commit

Permalink
Merge pull request #9004 from AbdelrahmanHafez/remove-faq-ipv6
Browse files Browse the repository at this point in the history
docs(faq): remove faq ipv6
  • Loading branch information
vkarpov15 committed May 15, 2020
2 parents d5fa450 + d0674d9 commit 33b4fd4
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions docs/faq.pug
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

0 comments on commit 33b4fd4

Please sign in to comment.