[GODRIVER-1156] CountDocuments doesn't work with a hint Created: 20/Jun/19  Updated: 27/Oct/23  Resolved: 05/Aug/19

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: 1.0.1
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Palash Nigam Assignee: Emmanuel Eppinger (Inactive)
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mongodb v4.0.6
driver v1.0.1
OS: Ubuntu 18.04
Go: 1.12


Attachments: File count_documents.go    

 Description   

I am trying to run CountDocuments with a hint but it isn't working. It returns an error `unrecognized field hint`

 

This is my code

 

```
opts := &options.CountOptions{}
        opts.SetHint("formId_1_client_1_isActive_1__p_createdBy_1__created_at_1")
        count, err := r.collection.CountDocuments(ctx, query, opts)
        if err != nil {
            return 0, err
        }
        return count, nil
```



 Comments   
Comment by Emmanuel Eppinger (Inactive) [ 24/Jun/19 ]

https://stackoverflow.com/questions/56684987/mongodb-golang-driver-not-returns-unrecognized-field-hint-when-using-hint-with/56720193#56720193

Comment by Emmanuel Eppinger (Inactive) [ 24/Jun/19 ]

Hi Palash,

Would you be able to provide a SSCCE (http://sscce.org/) that reproduces the issue on the master branch?

Thanks,

Emmanuel

Comment by Palash Nigam [ 24/Jun/19 ]

https://stackoverflow.com/questions/56684987/mongodb-golang-driver-not-returns-unrecognized-field-hint-when-using-hint-with/56720193#56720193

Comment by Emmanuel Eppinger (Inactive) [ 21/Jun/19 ]

Hi Palash,

I was unable to reproduce this issue. Would you be able to give a full reproduction of this bug? Something like a complete file that prints out the error.

Also would you be able to do this for 1.0.3?

Thanks,

Emmanuel

Generated at Thu Feb 08 08:35:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.