Skip to content

Commit

Permalink
Incorporate schema root into docID
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Jun 10, 2024
1 parent 21839d2 commit bb67f1f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,11 @@ func (doc *Document) GenerateDocID() (DocID, error) {
return DocID{}, err
}

// The DocID must take into consideration the schema root, this ensures that
// otherwise identical documents created using different schema will have different
// document IDs - we do not want cross-schema docID collisions.
bytes = append(bytes, []byte(doc.collectionDefinition.Schema.Root)...)

cid, err := ccid.NewSHA256CidV1(bytes)
if err != nil {
return DocID{}, err
Expand Down

0 comments on commit bb67f1f

Please sign in to comment.