optimize query event from mongodb