使用gin-golang将数据从mongodb显示到html页面?

I am trying to check if the MongoDB have data with specific username and password. But now I am getting all the data instead of the specified data. Below is my code:

r.POST("/login", func(c *gin.Context) {
    logedUser :=[]RegisterdUser{}
    name := c.PostForm("userName")
    Password := c.PostForm("userPassword")

    fmt.Println("inside checking  sectionnnn",name,Password)
    session, err := mgo.Dial("localhost:27017")
     if err != nil {
            panic(err)
     }
     s := session.Clone()
     db := s.DB("testing").C("testData")
    //err = db.Find(nil).All(&logedUser)
    err = db.Find(bson.M{"name": name,"password" :Password}).All(&logedUser)
        //err = db.Find({"Name": name},{"Password" :Password}).All(&logedUser)
        if err != nil {
            log.Fatal(err)
    log.Println("inside error")
        }
    //if logedUser !=nil{
    //fmt.Println("logged")
    //c.Redirect(301, "/loggedPage")

    //}else{
        //c.Redirect(301, "/loginError")
    //}
    fmt.Println("data fetched",logedUser)

        c.Next()
    defer session.Close()




  })

My DB structure is:

{ "_id" : ObjectId("5a7ac6150e04b2e9c18c15af"), "name" : "aswathy", "password" : "aswathyashok" }
{ "_id" : ObjectId("5a7ad3ef0e04b2e9c18c15d1"), "name" : "anupama", "password" : "anu" }
{ "_id" : ObjectId("5a7bf0dcd90e2ccd0bd9785b"), "name" : "reema", "password" : "reemaaa" }
{ "_id" : ObjectId("5a7bf1f6d90e2ccd0bd97895"), "name" : "sreeda", "password" : "sreeda" }

The Result of inside checking section is aswathy aswathyshok.

result of data fetched is

[{aswathy aswathyashok} {anupama anu} {reema reemaaa} {sreeda sreeda} {deena deena} {farsu farsu} {beena beena} {jeena jeena}]

As I understand you are looking for a specific and unique record. If it is so I would suggest to use just a single struct logedUser := RegisterdUser{} instead of a slice logedUser :=[]RegisterdUser{} and this method https://godoc.org/gopkg.in/mgo.v2#Query.One, so you will have err = db.Find(bson.M{"name": name,"password" :Password}).One(&logedUser)