storing rules in MongoDB

520 views
Skip to first unread message

Brian Thibault

unread,
Dec 3, 2013, 6:14:23 PM12/3/13
to no...@googlegroups.com
Hi all,

Anybody done this before?

Currently, I am storing some rule JSON in MongoDB, and retrieving it in node with Mongoose.js, then passing it off to Nools for processing. 

What i'm wondering is, if anyone has any thoughts on possible solutions to store the rule language. 

In works I'm storing something like this 

name: "Block 1",
  rules: [
    {
      field: "name",
      evaluator: "equal",
      criteria: "Jon Smith",
      action: "modify"
      operator: "AND",
    }
  ]

Then my thought was to write a rule builder , to get something nools can understand  . I've looked at a lot of rule engine solutions and there doesn't seem to be a standard way of dynamically building and storing rules from a gui frontend, which is what i'm doing. 

Brian Thibault

unread,
Dec 5, 2013, 12:32:18 PM12/5/13
to no...@googlegroups.com
Nevermind, not sure what I was thinking.. no need to translate to the DSL, just use my own stored JSON language and then the programmatic flows in Nools. 

snow crash

unread,
Feb 9, 2014, 4:50:46 AM2/9/14
to no...@googlegroups.com
Hey Brian,

I have the same idea in mind. Nethertheless, did you manage the fact that if a new Rule is inserted in the collection, it should automatically trigger its insertion in a given Flow and session recreation ?

Maybe you don't have the need and I do and I wonder how to do so efficiently :)

matt

Brian Thibault

unread,
Feb 9, 2014, 1:21:43 PM2/9/14
to no...@googlegroups.com
Matt, 

So I'm not quite doing that... 

however my thought would be 2 things.

1. there is a open issue on GitHub for streaming facts into a session https://github.com/C2FO/nools/issues/97  (in fact i was going to take a crack at working on it, maybe i'll i have some time this week. ) 

2. Another solution might be to use mongodbs tailable cursor http://docs.mongodb.org/manual/tutorial/create-tailable-cursor/  with a listener to see when a new fact comes in, then you may be able to somehow append it to a flow or session. 

Thanks
BT

Reply all
Reply to author
Forward
0 new messages