You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/includes/usage-examples/code-snippets/count.go
+20-13Lines changed: 20 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -13,14 +13,24 @@ import (
13
13
"go.mongodb.org/mongo-driver/v2/mongo/options"
14
14
)
15
15
16
+
typeRestaurantstruct {
17
+
ID bson.ObjectID`bson:"_id"`
18
+
Namestring
19
+
RestaurantIdstring`bson:"restaurant_id"`
20
+
Cuisinestring
21
+
Addressinterface{}
22
+
Boroughstring
23
+
Gradesinterface{}
24
+
}
25
+
16
26
funcmain() {
17
27
iferr:=godotenv.Load(); err!=nil {
18
28
log.Println("No .env file found")
19
29
}
20
30
21
31
varuristring
22
32
ifuri=os.Getenv("MONGODB_URI"); uri=="" {
23
-
log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/connect/mongoclient/#environment-variable")
33
+
log.Fatal("You must set your 'MONGODB_URI' environment variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable")
0 commit comments