Skip to content

Multiple Records Inserted in DB #16

@joshua1

Description

@joshua1

Hi,
I tried using the code snippet below to insert data into a table in rethinkDB if those records do not exist. This runs ok, but multiple Data rows with just Id and nothing else are created alongside the data i am trying to save. a single forloop or forEach run of just 14 records produces inserts of 140 records. Please look at my code and tell me what is wrong. i am on the verge of removing the rethinkDB storage lib

  const markups = client.record.getList('Markups');
  console.log(`Number of records is ${markups.getEntries().length}`);
  console.log(markups.getEntries());
  if (markups.isEmpty()) {
    // create the record for each markup
    for (var i = 0;i < markupSeeds.length;i++) {
      const id = 'Markups/' + client.getUid();
      const toSave = new MarkupsModel(markupSeeds[i]);
      client.record.getRecord(id).set(toSave);
    }
    markups.discard();
  }

markups always returns as an empty list despite the multitude of records in the Markups Table in the DB
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions