mongo logic simplified