2022-08-28 10:39:38 +02:00

29 lines
455 B
Go

package controllers
import (
"context"
"fmt"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
)
func GetGames(db *mongo.Database){
coll := db.Collection("Games")
var result bson.M
cur, err := coll.Find(context.TODO(), bson.D{{}})
if err != nil {
if err == mongo.ErrNoDocuments {
// This error means your query did not match any documents.
return
}
panic(err)
}
fmt.Println(cur)
fmt.Println(result)
}