diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index b5e10873385..29d4c024659 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,9 @@ + + + + **Do you want to request a *feature* or report a *bug*?** **What is the current behavior?** diff --git a/docs/faq.md b/docs/faq.md index 8c6341ce907..a1cb87e7afb 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -12,6 +12,44 @@ hr { } +
+ +**Q**. Operation `...` timed out after 10000 ms. What gives? + +**A**. At its core, this issue stems from not connecting to MongoDB. +You can use Mongoose before connecting to MongoDB, but you must connect at some point. For example: + +```javascript +await mongoose.createConnection(mongodbUri); + +const Test = mongoose.model('Test', schema); + +await Test.findOne(); // Will throw "Operation timed out" error because didn't call `mongoose.connect()` +``` + +```javascript +await mongoose.connect(mongodbUri); + +const db = mongoose.createConnection(); + +const Test = db.model('Test', schema); + +await Test.findOne(); // Will throw "Operation timed out" error because `db` isn't connected to MongoDB +``` + + **Q**. I am able to connect locally but when I try to connect to MongoDB Atlas I get this error. What gives? + +You must ensure that you have whitelisted your ip on [mongodb](https://docs.atlas.mongodb.com/security/ip-access-list/) to allow Mongoose to connect. +You can allow access from all ips with `0.0.0.0/0`. + +
+ +**Q**. x.$__y is not a function. What gives? + +**A**. This issue is a result of having multiple versions of mongoose installed that are incompatible with each other. +Run `npm list | grep "mongoose"` to find and remedy the problem. +If you're storing schemas or models in a separate npm package, please list Mongoose in `peerDependencies` rather than `dependencies` in your separate package. +
**Q**. I declared a schema property as `unique` but I can still save duplicates. What gives?