Convert document to object through referenced parameter.