package dbAccess import ( "context" "errors" "git.fjla.uk/owlboard/go-types/pkg/database" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" ) func GetPisMetadata() (*database.PisMetadata, error) { coll := MongoClient.Database(DatabaseName).Collection(MetaCollection) filter := bson.M{"type": "PisMetadata"} var result database.PisMetadata err := coll.FindOne(context.Background(), filter).Decode(&result) if err != nil { if errors.Is(err, mongo.ErrNoDocuments) { return nil, nil } return nil, err } return &result, nil }