Skip to content

Commit

Permalink
unmarshal objectid to interface
Browse files Browse the repository at this point in the history
  • Loading branch information
eparker-tulip committed Oct 3, 2024
1 parent a8dd01c commit e003513
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions lib/oplog/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,21 +510,13 @@ func (tailer *Tailer) parseRawOplogEntry(entry rawOplogEntry, txIdx *uint) []opl
} else {
idLookup := entry.Doc.Lookup("_id")
if idLookup.IsZero() {
log.Log.Errorf("failed to get objectId: _id is empty or not set")
log.Log.Error("failed to get objectId: _id is empty or not set")
return nil
}
oid, ok := idLookup.ObjectIDOK()
if ok {
// this is left as ObjectID type for now so it can be properly converted in processor.go:56
out.DocID = oid
} else {
oidString, ok := idLookup.StringValueOK()
if ok {
out.DocID = oidString
} else {
log.Log.Error("failed to get objectId: _id is not ObjectID or String type", idLookup.String())
return nil
}
err := idLookup.Unmarshal(&out.DocID)
if err != nil {
log.Log.Error("failed to get objectId: _id is not ObjectID or String type", idLookup.String())
return nil
}
}

Expand Down

0 comments on commit e003513

Please sign in to comment.