我有一个 angularJS 前端,它使用 $resource 使用 HTTP 方法向我的 Go 服务器发送请求。我想在发送 PATCH 时更新现有的数据库条目。我需要向 GO 服务器提供多个数据字段。 angularJS 客户端应该如何发送数据,用什么格式?从 mgo doc 我发现下面的代码要更新。更新字段是否可以采用 Go 结构,该结构将从客户端接收的数据中解析并跳过空字段?
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)
我计划将数据作为查询发送到的 angularjs 代码。
UpdateOneSchedule.update({bkresources:dbResources},
function(data){
//on success
},
function(httpResponse){
//on error
if(httpResponse.status === 409){
}
});
BIG阳
相关分类