getByIds with checking for BSONObjectId validity