Compile and match MongoDB conditions in pure Ruby