finished mongo query and main