-
Notifications
You must be signed in to change notification settings - Fork 68
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
Best practive / help #95
Comments
I can not find a way for this library to work properly, I am already thinking about making the relationships manually using pouch only. |
@fransyozef With the way that CouchDB/PouchDB, works there are no auto-incrementing IDs like a SQL database. In PouchDB, you can opt to have an _id generated for you(a uuid I believe). This is how you would have the ID ahead of time. And since uuid's are pretty much guaranteed to to be unique you shouldn't have to worry. You can choose to have your HasMany relationships not represented by an array of IDs on the parent type. Take a look at this section of the README.md: https://github.com/pouchdb-community/relational-pouch#dont-save-hasmany. For this case you would first create the If you would like I can come up with a code sample for you. The code sample you are referring to is following a pattern where child |
Not really an issue but more help. I'm a bit confused.
what I don't understand in this code, you save a new author, and also add the new book foreignkeys. But in real life you would not know these keys before you created the book records. The author foreign key makes sense in the book records. So why the book id's in the 'books' array?
The text was updated successfully, but these errors were encountered: