query mongodb and form response