@@ -90,16 +90,16 @@ func (q *Query) Sort(fields ...string) QueryI {
9090 return newQ
9191}
9292
93- // SetArrayFilter use for apply update array
94- // For Example :
95- // var res = QueryTestItem{}
96- // change := Change{
97- // Update: bson.M{"$set": bson.M{"instock.$[elem].qty": 100}},
98- // ReturnNew: false,
99- // }
100- // cli.Find(context.Background(), bson.M{"name": "Lucas"}).
101- // SetArrayFilters(&options.ArrayFilters{Filters: []interface{}{bson.M{"elem.warehouse": bson.M{"$in": []string{"C", "F"}}},}}).
102- // Apply(change, &res)
93+ // SetArrayFilter use for apply update array
94+ // For Example :
95+ // var res = QueryTestItem{}
96+ // change := Change{
97+ // Update: bson.M{"$set": bson.M{"instock.$[elem].qty": 100}},
98+ // ReturnNew: false,
99+ // }
100+ // cli.Find(context.Background(), bson.M{"name": "Lucas"}).
101+ // SetArrayFilters(&options.ArrayFilters{Filters: []interface{}{bson.M{"elem.warehouse": bson.M{"$in": []string{"C", "F"}}},}}).
102+ // Apply(change, &res)
103103func (q * Query ) SetArrayFilters (filter * options.ArrayFilters ) QueryI {
104104 newQ := q
105105 newQ .arrayFilters = filter
@@ -238,8 +238,8 @@ func (q *Query) All(result interface{}) error {
238238}
239239
240240// Count count the number of eligible entries
241- func (q * Query ) Count () (n int64 , err error ) {
242- opt := options .Count ( )
241+ func (q * Query ) Count (opts ... * options. CountOptions ) (n int64 , err error ) {
242+ opt := options .MergeCountOptions ( opts ... )
243243
244244 if q .limit != nil {
245245 opt .SetLimit (* q .limit )
@@ -252,8 +252,10 @@ func (q *Query) Count() (n int64, err error) {
252252}
253253
254254// EstimatedCount count the number of the collection by using the metadata
255- func (q * Query ) EstimatedCount () (n int64 , err error ) {
256- return q .collection .EstimatedDocumentCount (q .ctx )
255+ func (q * Query ) EstimatedCount (opts ... * options.EstimatedDocumentCountOptions ) (n int64 , err error ) {
256+ co := options .MergeEstimatedDocumentCountOptions (opts ... )
257+
258+ return q .collection .EstimatedDocumentCount (q .ctx , co )
257259}
258260
259261// Distinct gets the unique value of the specified field in the collection and return it in the form of slice
0 commit comments