如何获得收藏品的独特价值

I am trying the use of mongodb and Go and I cannot get the distinct values of the field in a collection.

This is my code:

import (
    "context"
    "fmt"
    "log"
    "time"

    "go.mongodb.org/mongo-driver/mongo"
    "go.mongodb.org/mongo-driver/mongo/options"
)


type House struct {
    Ciudad string
}


func main() {

    client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://localhost:27017"))
    if err != nil {
        log.Fatal(err)
    }
    ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
    err = client.Connect(ctx)

    collection := client.Database("test").Collection("houses")

    var house repository.House

    fmt.Println(collection.Distinct(ctx, "City", &house))

}

After execute this always I am geting an empty array. Any idea that is wrong in this code?

Replace the line

fmt.Println(collection.Distinct(ctx, "City", &house))

With

fmt.Println(collection.Distinct(ctx, "City", bson.D{{}}))

The third parameter, filter, is a BSON document, https://godoc.org/go.mongodb.org/mongo-driver/mongo#Collection.Distinct. Note that Distinct() returns two values, ([]interface, error).