Skip to content

Commit

Permalink
fix imports and api links for builders pattern (#419)
Browse files Browse the repository at this point in the history
* fix imports and api links for builders pattern

* small fix

* small fix

* remove quickstart as its in another ticket

(cherry picked from commit 447bb73)
  • Loading branch information
rustagir committed Jan 23, 2025
1 parent 83025ac commit e14108b
Show file tree
Hide file tree
Showing 59 changed files with 162 additions and 158 deletions.
1 change: 1 addition & 0 deletions snooty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ driver-long = "MongoDB Go Driver"
driver-short = "Go driver"
docs-branch = "master"
version = "v2.0"
full-version = "{+version+}.0"
example = "https://raw.githubusercontent.com/mongodb/docs-golang/{+docs-branch+}/source/includes/usage-examples/code-snippets"
api = "https://pkg.go.dev/go.mongodb.org/mongo-driver/{+api-version+}"
stable-api = "Stable API"
Expand Down
8 changes: 4 additions & 4 deletions source/fundamentals/aggregation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ operations, keep the following in mind:
- Returned documents must not violate the :manual:`BSON document size
limit </reference/limits/#BSON-Document-Size>` of 16 megabytes.
- Pipeline stages have a memory limit of 100 megabytes by default. If
required, you may exceed this limit by using the `allowDiskUse
<{+api+}/mongo/options#AggregateOptions.SetAllowDiskUse>`__
required, you may exceed this limit by using the `allowDiskUse()
<{+api+}/mongo/options#AggregateOptionsBuilder.SetAllowDiskUse>`__
method.
- The :manual:`$graphLookup
</reference/operator/aggregation/graphLookup/>` stage
has a strict memory limit of 100 megabytes and ignores
``allowDiskUse``.
has a strict memory limit of 100 megabytes and ignores the
``allowDiskUse`` setting.

Examples
--------
Expand Down
3 changes: 2 additions & 1 deletion source/fundamentals/collations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,5 @@ API Documentation:
- `IndexModel <{+api+}/mongo#IndexModel>`__
- `CreateOne() <{+api+}/mongo#IndexView.CreateOne>`__
- `IndexOptions <{+api+}/mongo/options#IndexOptions>`__
- `UpdateOptions <{+api+}/mongo/options#UpdateOptions>`__
- `UpdateOneOptions <{+api+}/mongo/options#UpdateOneOptions>`__
- `UpdateManyOptions <{+api+}/mongo/options#UpdateManyOptions>`__
2 changes: 1 addition & 1 deletion source/fundamentals/connections/tls.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,4 @@ guide, see the following API documentation:
- `ClientOptions <{+api+}/mongo/options#ClientOptions>`__
- `SetTLSConfig() <{+api+}/mongo/options#ClientOptions.SetTLSConfig>`__
- `tls package <https://pkg.go.dev/crypto/tls>`__
- `x509 package <https://pkg.go.dev/crypto/x509>`__
- `x509 package <https://pkg.go.dev/crypto/x509>`__
7 changes: 4 additions & 3 deletions source/fundamentals/crud/read-operations/limit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ API Documentation
To learn more about any of the methods or types discussed in this
guide, see the following API Documentation:

- `FindOptions.SetLimit() <{+api+}/mongo/options#FindOptions.SetLimit>`__
- `FindOptions.SetSort() <{+api+}/mongo/options#FindOptions.SetSort>`__
- `FindOptions.SetSkip() <{+api+}/mongo/options#FindOptions.SetSkip>`__
- `FindOptionsBuilder.SetLimit() <{+api+}/mongo/options#FindOptionsBuilder.SetLimit>`__
- `FindOptionsBuilder.SetSort() <{+api+}/mongo/options#FindOptionsBuilder.SetSort>`__
- `FindOptionsBuilder.SetSkip() <{+api+}/mongo/options#FindOptionsBuilder.SetSkip>`__
- `Aggregate() <{+api+}/mongo#Collection.Aggregate>`__
- `CountDocuments() <{+api+}/mongo#Collection.CountDocuments>`__
- `GridFSBucket.Find() <{+api+}/mongo#GridFSBucket.Find>`__

2 changes: 1 addition & 1 deletion source/fundamentals/crud/read-operations/project.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ To learn more about any of the methods or types discussed in this
guide, see the following API Documentation:

- `Find() <{+api+}/mongo#Collection.Find>`__
- `FindOptions.SetProjection() <{+api+}/mongo/options#FindOptions.SetProjection>`__
- `FindOptionsBuilder.SetProjection() <{+api+}/mongo/options#FindOptionsBuilder.SetProjection>`__
- `FindOne() <{+api+}/mongo#Collection.FindOne>`__
- `FindOneAndDelete() <{+api+}/mongo#Collection.FindOneAndDelete>`__
- `FindOneAndReplace() <{+api+}/mongo#Collection.FindOneAndReplace>`__
Expand Down
2 changes: 1 addition & 1 deletion source/fundamentals/crud/read-operations/skip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ To learn more about any of the methods or types discussed in this
guide, see the following API Documentation:

- `Find() <{+api+}/mongo#Collection.Find>`__
- `FindOptions.SetSkip() <{+api+}/mongo/options#FindOptions.SetSkip>`__
- `FindOptionsBuilder.SetSkip() <{+api+}/mongo/options#FindOptionsBuilder.SetSkip>`__
- `Aggregate() <{+api+}/mongo#Collection.Aggregate>`__
- `CountDocuments() <{+api+}/mongo#Collection.CountDocuments>`__
- `GridFSBucket.Find() <{+api+}/mongo#GridFSBucket.Find>`__
2 changes: 1 addition & 1 deletion source/fundamentals/crud/read-operations/sort.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ To learn more about any of the methods or types discussed in this
guide, see the following API Documentation:

- `Find() <{+api+}/mongo#Collection.Find>`__
- `FindOptions.SetSort() <{+api+}/mongo/options#FindOptions.SetSort>`__
- `FindOptionsBuilder.SetSort() <{+api+}/mongo/options#FindOptionsBuilder.SetSort>`__
- `Aggregate() <{+api+}/mongo#Collection.Aggregate>`__
- `FindOne() <{+api+}/mongo#Collection.FindOne>`__
- `FindOneAndDelete() <{+api+}/mongo#Collection.FindOneAndDelete>`__
Expand Down
4 changes: 2 additions & 2 deletions source/fundamentals/crud/read-operations/text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,5 @@ To learn more about any of the methods or types discussed in this
guide, see the following API Documentation:

- `Find() <{+api+}/mongo#Collection.Find>`__
- `FindOptions.SetSort() <{+api+}/mongo/options#FindOptions.SetSort>`__
- `FindOptions.SetProjection() <{+api+}/mongo/options#FindOptions.SetProjection>`__
- `FindOptionsBuilder.SetSort() <{+api+}/mongo/options#FindOptionsBuilder.SetSort>`__
- `FindOptionsBuilder.SetProjection() <{+api+}/mongo/options#FindOptionsBuilder.SetProjection>`__
10 changes: 5 additions & 5 deletions source/fundamentals/crud/write-operations/upsert.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Example

The following example performs the following actions:

- Matches documents where the ``species`` is "Ledebouria socialis" and
the ``plant_id`` is ``3``
- Matches documents where the ``species`` is ``"Ledebouria socialis"``
and the ``plant_id`` is ``3``
- Updates the ``height`` of the matched document to ``8.3``
- Inserts this document if there are no matches to the query filter

Expand All @@ -101,7 +101,7 @@ The following example performs the following actions:

filter := bson.D{{"species", "Ledebouria socialis"}, {"plant_id", 3}}
update := bson.D{{"$set", bson.D{{"species", "Ledebouria socialis"}, {"plant_id", 3}, {"height", 8.3}}}}
opts := options.Update().SetUpsert(true)
options.UpdateOne().SetUpsert(true)

result, err := coll.UpdateOne(context.TODO(), filter, update, opts)
if err != nil {
Expand Down Expand Up @@ -152,6 +152,6 @@ guide, see the following API Documentation:
- `ReplaceOne() <{+api+}/mongo#Collection.ReplaceOne>`__
- `FindOneAndUpdate() <{+api+}/mongo#Collection.FindOneAndUpdate>`__
- `FindOneAndReplace() <{+api+}/mongo#Collection.FindOneAndReplace>`__
- `UpdateOptions.SetUpsert() <{+api+}/mongo/options#UpdateOptions.SetUpsert>`__
- `ReplaceOptions.SetUpsert() <{+api+}/mongo/options#ReplaceOptions.SetUpsert>`__
- `UpdateOneOptionsBuilder.SetUpsert() <{+api+}/mongo/options#UpdateOneOptionsBuilder.SetUpsert>`__
- `ReplaceOptionsBuilder.SetUpsert() <{+api+}/mongo/options#ReplaceOptionsBuilder.SetUpsert>`__
- `UpdateResult <{+api+}/mongo#UpdateResult>`__
3 changes: 2 additions & 1 deletion source/fundamentals/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ guide, see the following API Documentation:
- `IndexModel <{+api+}/mongo#IndexModel>`__
- `CreateOne() <{+api+}/mongo#IndexView.CreateOne>`__
- `IndexOptions <{+api+}/mongo/options#IndexOptions>`__
- `SetDefaultLanguage() <{+api+}/mongo/options#IndexOptions.SetDefaultLanguage>`__
- `SetDefaultLanguage()
<{+api+}/mongo/options#IndexOptionsBuilder.SetDefaultLanguage>`__
- `DropOne() <{+api+}/mongo#IndexView.DropOne>`__
- `CreateCollection() <{+api+}/mongo#Database.CreateCollection>`__
- `CreateCollectionOptions <{+api+}/mongo/options#CreateCollectionOptions>`__
5 changes: 3 additions & 2 deletions source/fundamentals/time-series.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ To learn more about any of the methods or types discussed in this
guide, see the following API Documentation:

- `TimeSeriesOptions <{+api+}/mongo/options#TimeSeriesOptions>`__
- `SetTimeField() <{+api+}/mongo/options#TimeSeriesOptions.SetTimeField>`__
- `SetTimeField() <{+api+}/mongo/options#TimeSeriesOptionsBuilder.SetTimeField>`__
- `CreateCollection() <{+api+}/mongo#Database.CreateCollection>`__
- `SetTimeSeriesOptions() <{+api+}/mongo/options#CreateCollectionOptions.SetTimeSeriesOptions>`__
- `SetTimeSeriesOptions()
<{+api+}/mongo/options#CreateCollectionOptionsBuilder.SetTimeSeriesOptions>`__
- `RunCommand() <{+api+}/mongo#Database.RunCommand>`__
2 changes: 1 addition & 1 deletion source/fundamentals/transactions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,5 @@ guide, see the following API Documentation:
- `Client <{+api+}/mongo#Client>`__
- `StartSession() <{+api+}/mongo#Client.StartSession>`__
- `TransactionOptions <{+api+}/mongo/options#TransactionOptions>`__
- `SetWriteConcern() <{+api+}/mongo/options#TransactionOptions.SetWriteConcern>`__
- `SetWriteConcern() <{+api+}/mongo/options#TransactionOptionsBuilder.SetWriteConcern>`__
- `InsertMany() <{+api+}/mongo#Collection.InsertMany>`__
4 changes: 2 additions & 2 deletions source/includes/authentication/azure-imds-client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions source/includes/authentication/eks-custom-callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"os"

"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions source/includes/authentication/gcp-imds-client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions source/includes/authentication/gke-callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"os"

"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/bulkOps.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-book-struct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// begin struct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-course-struct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-tea-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-sample-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-book-struct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-course-struct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package main
import (
"fmt"

"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-book-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-course-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-course-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-tea-struct
Expand Down
8 changes: 4 additions & 4 deletions source/includes/fundamentals/code-snippets/CRUD/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"os"
"time"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/bson/primitive"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-tea-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/runCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/skip.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-course-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-course-struct
Expand Down
6 changes: 3 additions & 3 deletions source/includes/fundamentals/code-snippets/CRUD/textSearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"log"
"os"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
)

// start-dish-struct
Expand Down
Loading

0 comments on commit e14108b

Please sign in to comment.