Update embedded field in MongoDB using Golang

Hi @nraboy ,

Above I’ve provided wrapper written over MongoDB in 2 nd point . There I am doing marshalling and unmarshalling , i.e is the reason I’ve used JSON data structure .

Repo: GitHub - vibhordubey333/MoviesDB: Microservice written in Golang , where user can save new movies as well as rate, comment them . Functionality is similar to IMDB website where guest can see the movies , logged in users can comment , rate , admin can save new movies . For DB MongoDB is used.

I thought may be using the “map[string]interface{}” data structure is wrong , so I am tried changing my structure also , but no luck :frowning: .

package entities
type IMDBRegistryImproved struct {
MovieName string json:"moviename,omitempty"
Rating string json:"rating,omitempty"
RatingCount int json:"peoplecount,omitempty"
Comments UserComments json:"comments,omitempty"
}

type UserComments struct {
MovieName string bson: "MovieName" json:"MovieName,omitempty" //bson:"MovieName" json:“MovieName,omitempty”
UserName string bson: "UserName" json:"UserName,omitempty" //bson: json:"UserName,omitempty
UserComment string bson: "UserComment" json:"UserComment,omitempty" //json:"UserComment,omitempty
UserRating float32 bson: "UserRating" json:"UserRating,omitempty" //json:"UserRating,omitempty
}