@@ -90,16 +90,16 @@ func (q *Query) Sort(fields ...string) QueryI {
90
90
return newQ
91
91
}
92
92
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)
103
103
func (q * Query ) SetArrayFilters (filter * options.ArrayFilters ) QueryI {
104
104
newQ := q
105
105
newQ .arrayFilters = filter
@@ -238,8 +238,8 @@ func (q *Query) All(result interface{}) error {
238
238
}
239
239
240
240
// 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 ... )
243
243
244
244
if q .limit != nil {
245
245
opt .SetLimit (* q .limit )
@@ -252,8 +252,10 @@ func (q *Query) Count() (n int64, err error) {
252
252
}
253
253
254
254
// 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 )
257
259
}
258
260
259
261
// Distinct gets the unique value of the specified field in the collection and return it in the form of slice
0 commit comments