Skip to content

Commit

Permalink
Docs updates. (#1608)
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed May 8, 2024
1 parent 0fb5362 commit 781a76c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ These are fixes or information for common issues encountered by Go Driver users.

## `WriteXXX` can only write while positioned on a Element or Value but is positioned on a TopLevel

The [`bson.Marshal`](https://pkg.go.dev/go.mongodb.org/mongo-driver/bson#Marshal) function requires a parameter that can be decoded into a BSON Document, i.e. a [`primitive.D`](https://github.com/mongodb/mongo-go-driver/blob/master/bson/bson.go#L31). Therefore the error message
The [`bson.Marshal`](https://pkg.go.dev/go.mongodb.org/mongo-driver/bson#Marshal) function requires a parameter that can be decoded into a BSON Document, i.e. a [`bson.D`](https://pkg.go.dev/go.mongodb.org/mongo-driver/bson#D). Therefore the error message

> `WriteXXX` can only write while positioned on a Element or Value but is positioned on a TopLevel
Expand Down Expand Up @@ -34,7 +34,7 @@ sort := bson.D{}

## Convert BSON Document to JSON

There are a variety of marshalers that can be used to encode a BSON document as JSON, including [MarshalExtJSON](https://pkg.go.dev/github.com/mongodb/mongo-go-driver/bson#MarshalExtJSON):
There are a variety of marshalers that can be used to encode a BSON document as JSON, including [MarshalExtJSON](https://pkg.go.dev/go.mongodb.org/mongo-driver/bson#MarshalExtJSON):

```go
doc := bson.D{{"x", 1}}
Expand Down

0 comments on commit 781a76c

Please sign in to comment.