Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
Primary key autogenerating in RxDB
async function createDatabase() {
  addRxPlugin(RxDBReplicationCouchDBPlugin);
  addPouchPlugin(PouchdbAdapterIdb);
  addRxPlugin(RxDBLeaderElectionPlugin);

  const database = await createRxDatabase({
        name: 'dictionaries',
        storage: getRxStoragePouch('idb')
  });

  await database.addCollections({
    dictionaries: {
        schema: {
            title: 'dictionary',
            description: '',
            version: 0,
            primaryKey: 'id',
            type: 'object',
            keyCompression: false,
            properties: {
                id: {
                    type: 'string',
                    maxLength: 100,
                },
                name: {
                    type: 'string',
                    minLength: 1,
                    maxLength: 30,
                },
            },
            required: ['id', 'name']
        }
    }
  })
}

When I pass some value as an id, it is used as part of an auto-generated key:

const db = await createDatabase();
await db.dictionaries.newDocument({
  id: 'bar',
  name: 'English'
}).save(); // _doc_id_rev inside the db would be of format "bar::<auto-generated value>"

My question is is there any way to say RxDB that generating id's values for dictionaries is of its own concern or my single option is always to provide a dummy value, such as bar?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!