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

upsert bulk function #57

Open
etcware opened this issue Nov 18, 2017 · 1 comment
Open

upsert bulk function #57

etcware opened this issue Nov 18, 2017 · 1 comment

Comments

@etcware
Copy link

etcware commented Nov 18, 2017

I have a problem similar to https://stackoverflow.com/questions/44357946/update-more-than-one-document-in-a-loop and I tried to solve it as described in the last answer. But it doesn't work, because when the upsert diffFunc enter the external loop is ended and v1...v6 are valued by the last loop iteration. Is it possible to get the id value inside the upsert diffFunc? Do you can suggest any other solution? The last comment in the post is mine (Alessandra).

@dperetti
Copy link

Just faced this issue and did this:

Promise.all(notes.map(note => db.upsert(note.docId, doc => {
      doc.syncCursorId = syncCursorId
      return doc
})).then(results => console.log(results))

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

2 participants