convert referenced subdocuments to ids