Added funciton to build a mongo query from query fragments