garbados opened a new issue #1101: Mango queries with `conflicts: true` return 
documents that do not have conflicts
URL: https://github.com/apache/couchdb/issues/1101
 
 
   <!--- Provide a general summary of the issue in the Title above -->
   
   Queries to the `/{db}/_find` endpoint that set `conflicts: true` return 
documents that do not include conflicts. I have documented a test case 
[here](https://gist.github.com/garbados/335bc7c1836cbf726a6b511d6c0fa418) that 
reproduces the issue.
   
   The documentation in [cloudant/mango]() indicates that this is expected 
behavior:
   
   > conflicts (optional) (default: false) - boolean, whether or not to include 
information about any existing conflicts for the document.
   
   However, it sure would be nice to issue queries that return *only* 
conflicted documents that match the given selector.
   
   ## Expected Behavior
   <!--- If you're describing a bug, tell us what should happen -->
   <!--- If you're suggesting a change/improvement, tell us how it should work 
-->
   
   A query setting should exist to filter query results to only those that have 
conflicted and match the given selector.
   
   ## Current Behavior
   <!--- If describing a bug, tell us what happens instead of the expected 
behavior -->
   <!--- If suggesting a change/improvement, explain the difference from 
current behavior -->
   
   Setting `conflicts: true` returns documents with and without conflicts, such 
that the user must perform a second query to `/_all_docs` to determine which 
documents actually have conflicts.
   
   ## Possible Solution
   <!--- Not obligatory, but suggest a fix/reason for the bug, -->
   <!--- or ideas how to implement the addition or change -->
   
   Setting `onlyConflicts` or otherwise-named query value should cause CouchDB 
to filter results of a query to only those documents that match a given 
selector *and* which have conflicts.
   
   ## Steps to Reproduce (for bugs)
   <!--- Provide a link to a live example, or an unambiguous set of steps to -->
   <!--- reproduce this bug. Include code to reproduce, if relevant -->
   
   I've developed a test case 
[here](https://gist.github.com/garbados/335bc7c1836cbf726a6b511d6c0fa418) using 
node.js.
   
   ## Context
   <!--- How has this issue affected you? What are you trying to accomplish? -->
   <!--- Providing context helps us come up with a solution that is most useful 
in the real world -->
   
   Detecting conflicts requires finding them first. In large databases, 
performing one query to find documents that may have conflicts and then another 
to determine which of them actually do creates considerable request overhead 
for applications attempting to detect or resolve conflicts proactively.
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced 
the bug in -->
   * Version used: 2.1.1-180a155
   * Browser Name and version: N/A
   * Operating System and version (desktop or mobile): Ubuntu 16.04.3 LTS
   * Link to your project: 
[gist](https://gist.github.com/garbados/335bc7c1836cbf726a6b511d6c0fa418)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to