mongo serialization of rules
switch to mongo encoding