summaryrefslogtreecommitdiffstats
path: root/tests/auto/partition/json/reduce-subprop.json
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/partition/json/reduce-subprop.json')
-rw-r--r--tests/auto/partition/json/reduce-subprop.json58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/auto/partition/json/reduce-subprop.json b/tests/auto/partition/json/reduce-subprop.json
new file mode 100644
index 00000000..a5002853
--- /dev/null
+++ b/tests/auto/partition/json/reduce-subprop.json
@@ -0,0 +1,58 @@
+[
+ {
+ "_type": "Contact",
+ "displayName": "Joe Smith",
+ "name": {
+ "firstName": "joe",
+ "lastName": "smith"
+ }
+ },
+ {
+ "_type": "Contact",
+ "displayName": "Nancy Doe",
+ "name": {
+ "firstName": "nancy",
+ "lastName": "doe"
+ }
+ },
+ {
+ "_type": "Contact",
+ "displayName": "Nancy Doe",
+ "name": {
+ "firstName": "joe",
+ "lastName": "harrison"
+ }
+ },
+ {
+ "_type": "Contact",
+ "displayName": "Nancy Doe",
+ "name": {
+ "firstName": "nancy",
+ "lastName": "williams"
+ }
+ },
+ {
+ "_type": "Contact",
+ "displayName": "Nancy Doe",
+ "name": {
+ "firstName": "doug",
+ "lastName": "johnson"
+ }
+ },
+ {
+ "_type": "_schemaType",
+ "name": "NameCount",
+ "schema": {
+ "type": "object",
+ "extends": "View"
+ }
+ },
+ {
+ "_type": "Reduce",
+ "targetType": "NameCount",
+ "sourceType": "Contact",
+ "sourceKeyName": "name.firstName",
+ "add": "function add (k, z, c) { if (!z) { z = { count: 0 } }; z.count += 1; return z;}",
+ "subtract": "function subtract (k, z, c) { if (!z) {z = {count: 0}}; z.count -= 1; if (z.count) return z;}"
+ }
+]