diff --git a/internal/mongo/common.go b/internal/mongo/common.go index b47d5a8..15a1f72 100644 --- a/internal/mongo/common.go +++ b/internal/mongo/common.go @@ -67,7 +67,10 @@ func (g baseMethodGenerator) bsonFieldReference(fieldReference spec.FieldReferen func (g baseMethodGenerator) bsonTagFromField(field code.StructField) (string, error) { bsonTag, ok := field.Tag.Lookup("bson") if !ok { - return "", NewBsonTagNotFoundError(field.Name) + bsonTag, ok = field.Tag.Lookup("json") + if !ok { + return "", NewBsonTagNotFoundError(field.Name) + } } documentKey := strings.Split(bsonTag, ",")[0]