CMogilko on v6.2.2
CMogilko on master
upgrade version golang.org/x/sy… (compare)
Hello, how to fetch a subdocument list from documents
r.table("reportsdata").concat_map(lambda attendees: attendees['attendees'])
I have been able to create this python code. Now to convert it into gorethink, I have done till this much
r.table("reportsdata").Map(func(row r.Term) interface{} {
return row
}).Run(session)
but when I try r.table("reportsdata").Map(func(row r.Term) interface{} {
return row["attendees"]
}).Run(session)
query fails with invalid operation: row["attendees"] (type gorethink.Term does not support indexing)
How do I call the value with key attendees?
while Go demands This
Filter(func(row r.Term) r.Term {
return row.Field("updated_at").During(r.Time(2014, 8, 12, 'Z'), r.Time(2014, 8, 12, 'Z'))
}).Run(session)
I'm currently querying RethinkDB and then pushing them through https://github.com/martini-contrib/render.
How can I make this faster? Do I need to fill up the slice using cursor.All? Or can I stream the cursor directly into the JSON creator in some way?
r.DB("pi_baker").Table("observations").OrderBy(r.Desc("datetime")).Limit(5760).Pluck("datetime", "temp", "humidity").Run(session)
if err != nil {
log.Fatalln(err.Error())
}
var docRows []interface{}
cursor.All(&docRows)
renderer.JSON(200, map[string]interface{}{"obs": docRows})
cursor, err := r.DB("pi_baker").Table("observations").OrderBy(
r.OrderByOpts{
Index: r.Desc("datetime"),
}).Limit(5760).Pluck("datetime", "temp", "humidity").ToJSON().Run(session)