Currently I am running this in a http handler:
err := mongoCollection.Find(bson.M{"name": vars["name"]}).One(&result)
data, err := json.Marshal(result)
w.Write(data)
How can I begin serving the result before the full BSON data is in?
Edit: the answer needs to go beyond the mgo
extension and go into bson
. mgo
as far as I can see will only serve full documents if I not mistaken. I have one - possibly large - document as my code example clearly shows.