meteor-persistent-minimongo2 icon indicating copy to clipboard operation
meteor-persistent-minimongo2 copied to clipboard

Upsert not working (of course)

Open arichter83 opened this issue 5 years ago • 0 comments

I implemented some upsert like this:

if(!c.update()) c.insert()

Since the storage is not yet loaded on pageload, this will always trigger an insert and the ids are not collected in the Forage correctly (maybe some other bug).

My workaround is using the refresh callback for delaying the upsert:

  upsert_delayed(data) {
    local_observer.refresh(false, () => {
      upsert(data)
    })
  }

arichter83 avatar Mar 19 '19 11:03 arichter83