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

Document update question #67

Open
evgeniylissin opened this issue Jul 17, 2017 · 0 comments
Open

Document update question #67

evgeniylissin opened this issue Jul 17, 2017 · 0 comments

Comments

@evgeniylissin
Copy link

Hello, Geoff.
First of all thanks for your project.
I have a couple of questions and hope that you will help us to continue using your module.
I am checking this example:
http://redgeoff.github.io/delta-pouch/examples/profile/?iris

  1. I set the "name" field to "name1", click "save" - the result is 1 record in database with "name" set to "name1".
  2. I set the "name" field to "name2", click "save" - the result is 2 records in database, first has "name" set to "name1", second has "name" set to "name2".
    Now if I query for the documents I will have 2 documents, but I expect to have 1 document with the "name" set to "name2". How can I achieve this? Calling the delta-pouch's method all() is not convinient because if I have 1000 profiles in the database, and I need to get one by id, I need then to get all of them and then loop through the result.
    If I run delta-pouch's method cleanup() - then I have 1 record in database with "name" set to "name1", so the result is no changes in the database made. But it is not what we expect.

So shortly our question is following:

  1. Run db.save({_id: 'record1', title: 'test1'}).
  2. Run db.save({$id: 'record1', title: 'title1 updated'}).
    Is it possible to get the document by Id 'record1' without calling the all() method and then looping through the result?
    Does the delta-pouch merges the records then (maybe using cron?) so we have 1 record in database with title "title1 updated"?

Thank you in advance,
Eugene

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

1 participant