You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/faq.jade
+19-5Lines changed: 19 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -352,10 +352,10 @@ block content
352
352
doc.createdAt = new Date(2011, 5, 1).setHours(4);
353
353
doc.save(); // Works
354
354
```
355
-
355
+
356
356
<hr id="parallel_saves" />
357
-
358
-
**Q**. Why does calling `save()` multiple times on the same document in parallel only let
357
+
358
+
**Q**. Why does calling `save()` multiple times on the same document in parallel only let
359
359
the first save call succeed and return ParallelSaveErrors for the rest?
360
360
361
361
**A**. Due to the asynchronous nature of validation and middleware in general, calling
@@ -366,11 +366,25 @@ block content
366
366
367
367
**Q**. Why is **any** 12 character string successfully cast to an ObjectId?
368
368
369
-
**A**. Technically, any 12 character string is a valid [ObjectId](https://docs.mongodb.com/manual/reference/bson-types/#objectid).
369
+
**A**. Technically, any 12 character string is a valid [ObjectId](https://docs.mongodb.com/manual/reference/bson-types/#objectid).
370
370
Consider using a regex like `/^[a-f0-9]{24}$/` to test whether a string is exactly 24 hex characters.
371
371
372
+
<hr id="slow-localhost" />
373
+
374
+
**Q**. I'm connecting to `localhost` and it takes me nearly 1 second to connect. How do I fix this?
375
+
376
+
**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).
0 commit comments