correct getLatestId when document revision not comes from same family (closes #4216)

...efs #4216)