Fixed a bunch of query scenarios
Fixed detail queries for mongo db