janl commented on issue #1425: Add `conflicts: true` option to mango selectors URL: https://github.com/apache/couchdb/pull/1425#issuecomment-403289254 script to repro: ``` #!/bin/sh -ex S=http://a:[email protected]:15984 DB=x1101 # delete test db curl -X DELETE $S/$DB # create test d curl -X PUT $S/$DB # create doc curl -X PUT $S/$DB/doc -d '{"a":2}' # create conflict curl -X PUT $S/$DB/doc?new_edits=false -d '{"a":1,"_rev":"1-23202479633c2b380f79507a776743d5"}' # validate we have created a conflict: curl $S/$DB/doc?conflicts=true # create mango index def curl -X POST $S/$DB/_index -d '{"index":{"fields": ["_conflicts"]}}' -Hcontent-type:application/json # query mango index curl -X POST $S/$DB/_find -d '{"selector": {"_conflicts": { "$exists": true}},"conflicts":true}' -Hcontent-type:application/json # query mango index without conflicts option curl -X POST $S/$DB/_find -d '{"selector": {"_conflicts": { "$exists": true}}}' -Hcontent-type:application/json ``` Successful run: ``` ~/t.sh + S=http://a:[email protected]:15984 + DB=x1101 + curl -X DELETE http://a:[email protected]:15984/x1101 {"ok":true} + curl -X PUT http://a:[email protected]:15984/x1101 {"ok":true} + curl -X PUT http://a:[email protected]:15984/x1101/doc -d '{"a":2}' {"ok":true,"id":"doc","rev":"1-3975759ccff3842adf690a5c10caee42"} + curl -X PUT 'http://a:[email protected]:15984/x1101/doc?new_edits=false' -d '{"a":1,"_rev":"1-23202479633c2b380f79507a776743d5"}' {"ok":true,"id":"doc","rev":"1-23202479633c2b380f79507a776743d5"} + curl 'http://a:[email protected]:15984/x1101/doc?conflicts=true' {"_id":"doc","_rev":"1-3975759ccff3842adf690a5c10caee42","a":2,"_conflicts":["1-23202479633c2b380f79507a776743d5"]} + curl -X POST http://a:[email protected]:15984/x1101/_index -d '{"index":{"fields": ["_conflicts"]}}' -Hcontent-type:application/json {"result":"created","id":"_design/42ac6b715ea8fb5be44a74e6cf515eaa334238d6","name":"42ac6b715ea8fb5be44a74e6cf515eaa334238d6"} + curl -X POST http://a:[email protected]:15984/x1101/_find -d '{"selector": {"_conflicts": { "$exists": true}},"conflicts":true}' -Hcontent-type:application/json {"docs":[ {"_id":"doc","_rev":"1-3975759ccff3842adf690a5c10caee42","a":2,"_conflicts":["1-23202479633c2b380f79507a776743d5"]} ], "bookmark": "g1AAAABheJzLYWBgYMpgSmHgKy5JLCrJTq2MT8lPzkzJBYozA1kgKQ6YVA5QkBFMgKSVDHWNjI0MjEzMLc2MjZONkowtDNLMLU0NzBPNzc3MTYxTTLOysgCY2ReV"} + curl -X POST http://a:[email protected]:15984/x1101/_find -d '{"selector": {"_conflicts": { "$exists": true}}}' -Hcontent-type:application/json {"docs":[ ], "bookmark": "nil"} ```
---------------------------------------------------------------- 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
