()
| 68 | } |
| 69 | |
| 70 | func Example_openCollectionFromURL() { |
| 71 | // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored. |
| 72 | // PRAGMA: On gocloud.dev, add a blank import: _ "gocloud.dev/docstore/mongodocstore" |
| 73 | // PRAGMA: On gocloud.dev, hide lines until the next blank line. |
| 74 | ctx := context.Background() |
| 75 | |
| 76 | // docstore.OpenCollection creates a *docstore.Collection from a URL. |
| 77 | coll, err := docstore.OpenCollection(ctx, "mongo://my-db/my-collection?id_field=userID") |
| 78 | if err != nil { |
| 79 | log.Fatal(err) |
| 80 | } |
| 81 | defer coll.Close() |
| 82 | } |
nothing calls this directly
no test coverage detected