[GODRIVER-2624] How to run Find.().One in new go-mongo-driver Created: 28/Oct/22  Updated: 27/Oct/23  Resolved: 01/Nov/22

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

Type: Task Priority: Major - P3
Reporter: karthick d Assignee: Preston Vasquez
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Find.().Decode() fails with the below error 

 error was: cannot transform type []interface {} to a BSON Document: WriteArray can only write a Array while positioned on a Element or Value but is positioned on a TopLevel
 

I tried something like below: 

    login = model.LoginModel{}
    err = mongo.Collection.Find(bson.M{"name": MAXLOGINCOUNT}).Decode(&loginCount) 

Does it allow a struct as a value for decode ? I used find.().One in global sign that used to work just fine . 

 



 Comments   
Comment by karthick d [ 01/Nov/22 ]

I sorted this one out , please close this one . 

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