summaryrefslogtreecommitdiffstats
path: root/tests/auto/partition/json/map-join-sourceuuids.json
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/partition/json/map-join-sourceuuids.json')
-rw-r--r--tests/auto/partition/json/map-join-sourceuuids.json80
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/auto/partition/json/map-join-sourceuuids.json b/tests/auto/partition/json/map-join-sourceuuids.json
new file mode 100644
index 00000000..24ad24e7
--- /dev/null
+++ b/tests/auto/partition/json/map-join-sourceuuids.json
@@ -0,0 +1,80 @@
+[
+ {
+ "_type": "_schemaType",
+ "name": "MagicView",
+ "schema": {
+ "type": "object",
+ "extends": "View",
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "foo": {
+ "type": "string"
+ },
+ "bar": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ {
+ "_type": "_schemaType",
+ "name": "Foo",
+ "schema": {
+ "type": "object",
+ "properties": {
+ "magic": {
+ "type": "string",
+ "indexed": true
+ }
+ }
+ }
+ },
+ {
+ "_type": "_schemaType",
+ "name": "Bar",
+ "schema": {
+ "type": "object",
+ "extends": "Foo"
+ }
+ },
+ {
+ "_type": "Map",
+ "targetType": "MagicView",
+ "join": {
+ "Foo": " \
+ function map(obj, context) { \
+ var foo, bar; \
+ foo = obj; \
+ if (!context) { \
+ // callback to the Bar function below with foo as the context \
+ jsondb.lookup({'index':'magic', 'value':foo.magic, 'objectType': 'Bar'}, foo); \
+ } else { \
+ bar = context; \
+ jsondb.emit({ key: foo.magic, foo: foo._uuid, bar: bar._uuid, barExtra: bar.extra }); \
+ } \
+ } ",
+ "Bar": " \
+ function map(obj, context) { \
+ var foo, bar; \
+ bar = obj; \
+ if (!context) { \
+ // callback to the Foo function above with bar as the context \
+ jsondb.lookup({'index':'magic', 'value':bar.magic, 'objectType': 'Foo'}, bar); \
+ } else { \
+ foo = context; \
+ jsondb.emit({ key: foo.magic, foo: foo._uuid, bar: bar._uuid, barExtra: bar.extra }); \
+ } \
+ } "
+}
+ },
+ {
+ "_type": "Bar",
+ "magic": "xyzzy"
+ },
+ {
+ "_type": "Foo",
+ "magic": "xyzzy"
+ }
+]