[DOCS-16050] Document usage of regular expressions in Go Driver documentation Created: 19/Apr/23  Updated: 19/Apr/23  Resolved: 19/Apr/23

Status: Closed
Project: Documentation
Component/s: drivers
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Alexander Ignatyev Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on GODRIVER-2816 Create Documentation Examples for pri... Closed
Participants:
Days since reply: 42 weeks ago

 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.


Generated at Thu Feb 08 08:14:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.