Is there a way to do the following in CouchDB? One way to return specific, different values by a specific key?
Select a different area from the table WHERE key = "key1" 'key1' = & gt; 'Somevalue' 'key1' = & gt; 'Somevalue' 'key2' = & gt; '2' of 'avalval' = & gt; 'Andanius' 'Key2' = & gt; For example: "key1" ['somevalue'] will return
"key2" ['aval', 'endanath'] < P>
, you should place those values that you want to make unique in the key, then the function with group = true To reduce the query. For example, there is an area with values like "code1" and "key2" and standard , your map function may be: function (doc) {// Filter only interesting documents to get: Change if necessary (doc.keyfield & amp; doc.valuefield) {/ * * This important content : * * - In the emitted key, by inserting both the key and the value, * you can filter duplicates * (just the result group on the full key); * * - In the form of a bonus, by emitting 1 as the value, you get the number of duplicates by doing the job of reducing `_sum` * * / emit ([doc.keyfield, doc.valuefield], 1 ); }} and your lower function may be:
_sum then group = true Is & amp; {{"Key2"] and endkey = ["key2", {}} : > {"rows": [{"key": ["{" key2 "," Andanother "]," value ": 2}]} " "," value "
Comments
Post a Comment