-
Notifications
You must be signed in to change notification settings - Fork 81
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
clarify documentation for .connect method #86
Comments
Sorry for not getting back to you sooner. I've been away from the project for a bit but am finally getting back to maintaining it. Thanks for the suggestion. You're right that the documentation (especially for |
Also don't like the idea of connect just storing a global CLIENT object assuming my entire app is going to use a single connection/database. would be nice if I could have collections in different files and be able to specify which connection goes to which file (for NEDB). |
I had to play around with it for a little bit, but after reading the README and Scott's blog post, I realized almost everything returns a promise, so control flow can be managed with Since a lot of people learn Mongoose first (and in some cases have to use it at work), it might help to demonstrate an example using Mongoose and how Camo differs. For example, in an Express app with Mongoose, you can just put:
At the top of your Whereas in Camo, all database interactions must follow Here's a basic demo using async/await (you can use try/catch blocks for error handling), that might help anyone just getting started. Assume that a
@lurchpop, could you clarify your comment a little more - perhaps explain what your use case is? When you connect to a NeDB folder, Camo will create collection files for each Model you've defined (unless the Model is an |
Just a quick suggestion to clear this up with examples. I had to check the source at https://github.com/scottwrobinson/camo/blob/master/lib/db.js to get the right format.
The text was updated successfully, but these errors were encountered: