Filter – BangDB = NoSQL + AI + Stream



Filter is used to filter the incoming stream on some condition and then send the filtered data to other stream and/or notify as required.
Here is how it looks;

"fltr":[{"name":"f1", "fqry":{"name":"{\"query\":[{\"key\":\"h\", \"cmp_op\":0, \"val\":\"$n\"}],\"qtype\":2}", "type":1}, "fatr":["a", "b", "c", "g"], "catr":[{"name":"f1", "type":11, "opid":3]}], "ostm":"s2", "notf":1}, {"name":"f2", "fqry":{"name":"fltr_udf1", "type":2}, "fatr":["a", "b"], "catr":[{"name":"fltr1", "type":5, "opid":1"]}]
now let's look at the first one

{"name":"f1", "fqry":{"name":"{\"query\":[{\"key\":\"h\", \"cmp_op\":0, \"val\":\"$n\"}],\"qtype\":2}", "type":1}, "fatr":["a", "b", "c", "g"], "catr":[{"name":"f1", "type":11, "opid":3}], "ostm":"s2", "notf":123}
It creates a filter name f1, which filters based on fqry. As you see fqry is based on dataQuery (type which is also used to create query for db), for more discussion on this, please see dataQuery.

"fatr" is set of attributes that we send to filtered stream "s2", also on the fly we compute attribute f1 using "catr" which would be added to fatr set and sent to the output stream s2. See catr for more info on how to compute attribute