2015-09-22 52 views
0

我有這樣

$ db.histories.aggregate([{$match:{"issue_id":{$in:ids},"history_comment":{$exists:true,$not:{$size:0}}}},{$unwind:"$history_comment"}])

翻譯這go使用mgo

var h []History 
query := []bson.M{ 
    {"$match": bson.M{ 
     "issue_id":  bson.M{"$in": IDs}, 
     "history_comment": bson.M{"$exists": true, "$not": bson.M{"$size": 0}}}}, 
    {"$unwind": "$history_comment"}, 

} 

err := c.Pipe(query).All(&h) 

彙總查詢,但我收到了err

Unknown element kind (0x2E) 這怎麼可能?我的查詢錯誤?

+0

雖然bson試圖解碼您的數據,但它無法識別「種類」的數據。錯誤來自(d *解碼器)readElemTo函數在http://bazaar.launchpad.net/+branch/mgo/v1/view/head:/bson/decode.go中。您的數據似乎與任何bson類型都不兼容。 –

回答

0

返回的錯誤指出交給驅動程序的數據具有未知的元素種類。縱觀BSON規格,有確實沒有0x2E元素實物有:

http://bsonspec.org/spec.html

如果你認爲這是司機的問題,您可以請提供可裝入違規數據的轉儲司機,並與它開放的問題?

謝謝。