Go (Golang) library to parse and apply Kendo data query on a MongoDB database using mgo.
go get -u github.com/x22n/kendo-data-query
func MyHandler(w http.ResponseWriter, r *http.Request) {
ds, err := kendo.NewDataStateFromRequest(ctx.Request)
if err != nil {
// Error handling
}
...
// the following should not be directly in the handler, for reference only
session, err := mgo.DialWithInfo(mongoDBDialInfo)
collection := session.DB("db").C("collection")
dr := ds.Apply(collection)
}
{"data":[{"title":"cat","due":1.98},{"title":"dog","due":8.21},...],"total":325}
and
logic between filtersavg
and sum
aggregatesor
logic between filters