Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2624

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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    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 . 

       

      Attachments

        Activity

          People

            preston.vasquez@mongodb.com Preston Vasquez
            karthickcseapitam@gmail.com karthick d
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: