mgo $unwind aggregation result to Unknown element kind (0x2E)

给你一囗甜甜゛ 提交于 2019-12-13 02:17:02

问题


I have an aggregate query like this

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

translating this to go using 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)

but I received an err

Unknown element kind (0x2E) how is this possible? is my query wrong?


回答1:


The error returned is pointing out that the data being handed to the driver has an unknown element kind. Looking at the BSON specification, there's indeed no 0x2E element kind in there:

http://bsonspec.org/spec.html

If you think this is an issue in the driver, can you please provide a dump of the offending data that can be loaded into the driver, and open an issue with it?

Thank you.



来源:https://stackoverflow.com/questions/32716402/mgo-unwind-aggregation-result-to-unknown-element-kind-0x2e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!