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

Two LiveQueries over one view cause duplication of new rows #457

Closed
Shaddix opened this issue Jul 20, 2015 · 2 comments
Closed

Two LiveQueries over one view cause duplication of new rows #457

Shaddix opened this issue Jul 20, 2015 · 2 comments
Labels
Milestone

Comments

@Shaddix
Copy link

Shaddix commented Jul 20, 2015

I create a view and in some point of my application I need to create two LiveQueries to it (with different Key filter).
Then when I add documents to database, in each query.Changed handler I receive that documents as 2 completely identical rows (Id's are the same).
If I have only one LiveQuery everything works correct and documents are not duplicated.

These duplication persists over application restarts (even if I run normal Query against that view). But if I change Version field of the view and DB gets reindexed, there's no duplication (as expected, because there's only one doc in DB).

Is that a known problem? I could provide a small repro if needed, but just want to be sure it's not a known issue and it's not by design.

In pseudo-code:

var view = _database.GetView("dummy")
_database.SetMap((props, emit) => emit(props["Type"], null), "1");
var query1 = view.CreateQuery().ToLiveQuery();
query1.Start();
var query2 = view.CreateQuery().ToLiveQuery();
query2.Start();

...

var doc = _database.CreateDocument();
doc.PutProperties(new Dictionary<string, object>() {
 {"Type", "Project"},
});


after that in Changed event handler I receive duplicated rows.

I use latest Couchbase Lite package from nuget (1.1.0.1)

@borrrden
Copy link
Member

Yes, this is known and was corrected. More information here (it doesn't explicitly state this, but this is the reason that I had to make changed to UpdateIndex)

@borrrden
Copy link
Member

In the master branch, this unit test is now in place to check for this condition.

@zgramana zgramana added the bug label Jul 20, 2015
@zgramana zgramana added this to the 1.1.1 milestone Jul 20, 2015
@borrrden borrrden modified the milestones: 1.2, 1.1.1 Jul 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants