Parse and evaluate MongoDB queries in Ruby