How to run Find.().One in new go-mongo-driver

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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 . 

       

            Assignee:
            Preston Vasquez
            Reporter:
            karthick d
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: