Hokutosei
Hokutosei

Reputation: 2164

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

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?

Upvotes: 1

Views: 1324

Answers (1)

Gustavo Niemeyer
Gustavo Niemeyer

Reputation: 22991

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.

Upvotes: 1

Related Questions