replace $ with # in boolean expressions because $ generates invalid BSON.
add translation for preconds from python (working draft)