草庐IT

angularjs - 用 golang 重复记录

我是Golang的新手,我想在mongodb中读取汽车记录,所以我最多有29条记录我创建了一个cars.go充当Controller并用该代码填充它func(controllerCarController)GetIndex(c*gin.Context){carList:=controller.carService.Find(&bson.M{})c.JSON(http.StatusOK,&carList)//fmt.Println(carList)}在我的carService.go中我编写了代码func(rCarService)Find(query*bson.M)(cars[]model