Skip to content

Persistence with rxdb #116

Answered by maxnowack
kurtg-tmQ asked this question in Q&A
Aug 26, 2023 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Implement multiple collections with rxdb should be really straight forward. You just have to make sure that each signaldb collection uses an own persistence adapter with a dedicated rxdb collection.
One solution would be to create a factory function to create persistence adapters for different rxdb collections.

async function getCollectionByName(name: string) {
  // return the cached rxdb collection object for the given name or create it if it does not exist
}

function createPersistenceAdapterForRxdbCollection(collectionName: string) {
  const persistence: PersistenceAdapter<{ id: string, text: string, completed: boolean }, string> = {
    register: async (onChange) => {
      const coll…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@kurtg-tmQ
Comment options

@maxnowack
Comment options

Answer selected by maxnowack
Comment options

You must be logged in to vote
1 reply
@maxnowack
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants