Skip to content
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

[help] CouchDb 3.0 - Partitioned Databases #123

Open
TobyMosque opened this issue Mar 11, 2020 · 5 comments
Open

[help] CouchDb 3.0 - Partitioned Databases #123

TobyMosque opened this issue Mar 11, 2020 · 5 comments

Comments

@TobyMosque
Copy link

is there any way to config the format of the ids? currently: <type>_<id type>_<id>

I want to use <type>_<id type>:<id> instead of <type>_<id type>_<id> to take advantage on the new Partitioned Databases

Currently, as a workaround, I'm prefixing all my ids with :

@broerse
Copy link
Collaborator

broerse commented Mar 11, 2020

Not yet. But we are updating relational-pouch and ember-pouch now so we will take a look.

@TobyMosque
Copy link
Author

thx.

@srsgores
Copy link

Has this been added yet? If not, then why was this issue closed?

@broerse broerse reopened this Mar 12, 2020
@broerse
Copy link
Collaborator

broerse commented Mar 12, 2020

Opening again because this seems like a good thing to support. Because relational-pouch is already partitioned by type we could use CouchDB partitions for this to speed things up. You should be able to prefix you id's too so switching to partitioned types based on partitioned=true seems wrong.

Does anybody know if there is a data migration tool for this already?

I also think we should look closely at polymorphism and partitioning, to not miss, if possible, to improve on polymorphism partitions.

@TobyMosque
Copy link
Author

TobyMosque commented Mar 12, 2020

@broerse sorry for close the issue.

I'm prefixing my ids in order to use partitioned types at the couch/server and use relational-pouch at the browser/client.

COUCH_ID_PREFIX=:
import { v4 as uuid } from 'uuid'

export default {
  async demo (db) {
    const id = process.env.COUCH_ID_PREFIX + uuid()
    await db.rel.save('post', {
      title: 'Rails is Unagi',
      text: 'Delicious unagi. Mmmmmm.',
      id: id
    })
    const { posts: [ post ] } = await db.rel.get('post', id)
  }
}

but that is only a workaround, and a workaround is never a good thing, i'll remove that as soon u guys come with something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants