So I have a very Simple Struct which is persisted in the MongoDB
type Test struct {
ID string `bson:"_id"`
Status string `bson:"status"`
TestTime time.Time `bson:"TestTime"`
}
While Retrieving I want to make sure that I am not retrieving any value whose TestTime is not initialized i.e exclude missing/zero equivalent value of time.Time
filter := bson.M{"status": "Ready"}
Any advice on how should I update my filter criteria here
cursor, err := r.store.Db.Collection("testCollection").Find(ctx, filter)
if err != nil {
return err
}
err = cursor.All(ctx, result)
if err != nil {
return err
}
return nil
}