Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-16050

Document usage of regular expressions in Go Driver documentation

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • drivers
    • None

    Description

      The use of regexes in Go Driver is neither obvious nor well documented.

      In the driver package docs no regexes mentioned at all, at least I didn't find: https://pkg.go.dev/go.mongodb.org/mongo-driver@v1.11.2

      As a result people trying to creates reges something like:

      regex := primitive.Regex{Pattern: "/pattern/", Options: "i"}
      

      And it does not work, the correct code should be

      regex := primitive.Regex{Pattern: "pattern", Options: "i"}
      

      After some research I managed to find this page https://pkg.go.dev/go.mongodb.org/mongo-driver@v1.11.2/bson/primitive#Regex
      but it was just empty.

      I believe at least one example of using regexes should be added to the driver package's docs: https://pkg.go.dev/go.mongodb.org/mongo-driver@v1.11.2 Since it is not obvious how to do it.

      And the link to "primitives" package from the driver package should be easily accessible. 

       

      A/C:

      As a user, I can see how to create regular expressions with the Go driver.

      As a user, I can find a link to the "primitives" package in the driver.

      Attachments

        Activity

          People

            Unassigned Unassigned
            alexander.ignatyev@mongodb.com Alexander Ignatyev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              42 weeks ago