package leaf import ( "go.mongodb.org/mongo-driver/bson/primitive" ) func ObjectIDFromHex(hex string) primitive.ObjectID { id, err := primitive.ObjectIDFromHex(hex) if err != nil { return primitive.NilObjectID } return id } func ObjectIDFromHexSlice(hexSlice []string) []primitive.ObjectID { ids := make([]primitive.ObjectID, len(hexSlice)) for i := range hexSlice { ids[i] = ObjectIDFromHex(hexSlice[i]) } return ids }