I have an angularJS frontend using $resource to send requests using HTTP methods to my Go server. I want to update an existing db entry when I send a PATCH. I need to supply multiple data fields to the GO server. How should the angularJS client send the data, in what format? From the mgo doc I found the code below to update. Is it possible for the Update field to take a Go struct which will be parsed from data received from the client and skip the fields that are empty?
change := mgo.Change{
Update: bson.M{"$inc": bson.M{"n": 1}},
Upsert: false,
Remove: false,
ReturnNew: true,
}
info, err = col.Find(M{"_id": id}).Apply(change, &doc)
fmt.Println(doc.N)
My angularjs code where i plan to send the data as a query.
UpdateOneSchedule.update({bkresources:dbResources},
function(data){
//on success
},
function(httpResponse){
//on error
if(httpResponse.status === 409){
}
});