@@ -20,7 +20,8 @@ composite HelloWorldInsertSample {
20
20
greeting2 = "Hello again";
21
21
}
22
22
23
- stream<rstring error1, rstring error2, rstring error3, rstring error4, rstring error5, rstring error6> MongoSink = Insert(B1Stream; B2Stream){
23
+ stream<rstring error1, rstring error2, rstring error3, rstring error4, rstring error5, rstring error6, rstring error7, rstring error8> MongoSink =
24
+ Insert(B1Stream; B2Stream) {
24
25
param
25
26
dbHost : "localhost";
26
27
@@ -83,7 +84,25 @@ composite HelloWorldInsertSample {
83
84
* Store a constant map (map/tuple doesn't require key, but can use it to add a root key), the resulting document is:
84
85
* { "_id" : ObjectId("53c795f7e66ebea0c454c813"), "greeting5_1" : "Hello", "greeting5_2" : "world" }
85
86
*/
86
- error5 = InsertDocument("streams", "sample", {"greeting5_1" : "Hello", "greeting5_2" : "world"});
87
+ error5 = InsertDocument("streams", "sample", {"greeting5_1" : "Hello", "greeting5_2" : "world"}),
88
+
89
+ /**
90
+ * Store a constant rstring JSON, the resulting document is:
91
+ * { "_id" : ObjectId("53c795f7e66ebea0c454c814"), "greeting6_1" : "Hello", "greeting6_2" : "world" }
92
+ */
93
+ error6 = InsertDocumentAsJson("streams", "sample", '{"greeting6_1" : "Hello", "greeting6_2" : "world"}'),
94
+
95
+ /**
96
+ * Store a constant rstring JSON (doesn't require key, but can use it to add a root key), the resulting document is:
97
+ * { "_id" : ObjectId("53c795f7e66ebea0c454c815"), "greeting7_1" : { "greeting7_2" : [ "Hello", "world" ] } }
98
+ */
99
+ error7 = InsertDocumentAsJson("streams", "sample", "greeting7_1", '{"greeting7_2" : ["Hello", "world"]}'),
100
+
101
+ /**
102
+ * Store a constant rstring JSON with wrong syntax, the exception is:
103
+ * FailedToParse: First character in field must be [A-Za-z$_]: offset:1 of:{[ : "Hello world"}
104
+ */
105
+ error8 = InsertDocumentAsJson("streams", "sample", '{[ : "Hello world"}');
87
106
}
88
107
89
108
/**
0 commit comments