You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -94,21 +105,43 @@ The fields below are required unless you see a * after the name.
94
105
95
106
Each data source corresponds to a root property on the client side data model (collector.data). The data source configuration controls where data will come from and how it will be filtered.
96
107
97
-
*Manifest
108
+
*Collection
98
109
99
-
The manifest is a data structure which controls what fields get pushed out to a Collector. It treats arrays and objects the same, and does not care about data types. It will be applied to any data returned by the Payload or Delta functions. It is comprised of nested objects and boolean values. Data is not represented by default, so only the value 'true' has any meaning. You can use 'false' for explicit documentation if you would like.
110
+
The MongoDB collection you want to monitor.
100
111
101
-
You can assign 'true' at any point in the data structure. For instance, if you put 'true' at the root then no data will be filtered.
112
+
* Criteria
102
113
103
-
* Payload
114
+
The recordset you want to pull back. This generally looks like a Mongo query, except it supports looking up data in the user's identity and Particle's internal cache. For instance:
104
115
105
-
This function is responsible for retrieving initial data when a new Collector registers. It is passed the Identity associated with this Collector, and a callback function (err, data) for returning the data. You can use the Identity to limit the fields returned. The data returned by a Mongo query is suitable for this. Essentially it needs to be a collection of documents, where each document is comprised of a root object and nested objects, arrays, and data values.
This means "Grab the 'userId' field from the identity, and pipe it through a relationship to find any related stuffs._id's."
108
121
109
-
This function is passed the Identity of the Collector, and a receiver function. It is responsible for wiring up some kind of event source which will be forwarded by the Stream to any registered Collectors.
122
+
You can also supply a regular string or number:
110
123
111
-
I wrote a library for listening to the mongo oplog which can be used for this purpose. You can find it [here](https://github.com/torchlightsoftware/mongo-watch). You want to use the 'normal' format to get a message format compatible with Particle. Note that this will not work for shared DB hosting solutions. If you are interested in getting something working for that sort of platform I have some ideas... please contact me.
124
+
```coffee-script
125
+
criteria: {name:'Joe'}
126
+
```
127
+
128
+
Or a lookup by string:
129
+
130
+
```coffee-script
131
+
criteria: {colorId:'red|colors.name>colors._id'}
132
+
```
133
+
134
+
Or just an identity:
135
+
136
+
```coffee-script
137
+
criteria: {colorId:'@myColorId'}
138
+
```
139
+
140
+
* Manifest
141
+
142
+
The manifest controls what fields get pushed out to a Collector. It acts like a Mongo 'project' query modifier.
143
+
144
+
You can assign 'true' at any point in the data structure. For instance, if you put 'true' at the root then no data will be filtered.
0 commit comments