summaryrefslogtreecommitdiffstats
path: root/tests/auto/daemon/json/reduce.json
blob: f95d4f197acfcc7103affb035b3ec3e0ccec6aa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[
  {
    "_type": "_schemaType",
    "name": "MyContactCount",
    "schema": {
      "type": "object",
      "extends": "View",
      "properties": {
        "name": {
          "type": "string"
        }
      }
    }
  },
  {
    "_type": "Reduce",
    "targetType": "MyContactCount",
    "sourceType": "MyContact",
    "sourceKeyName": "firstName",
    "targetKeyName": "firstName",
    "targetValueName": "count",
    "add": "function add (k, z, c) { if (!z) {z = 0}; z += 1; if (z) return z;}",
    "subtract": "function subtract (k, z, c) { if (!z) {z = 0}; z -= 1; if (z) return z;}"
  }
]