我有一个这样的聚合查询
$ db.histories.aggregate([{$match:{"issue_id":{$in:ids},"history_comment":{$exists:true,$not:{$size:0}} }},{$unwind:"$history_comment"}])
使用 mgo
将其转换为 go
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
未知元素种类 (0x2E)
这怎么可能?我的查询有误吗?
最佳答案
返回的错误指出传递给驱动程序的数据具有未知的元素种类。查看 BSON 规范,其中确实没有 0x2E
元素类型:
如果您认为这是驱动程序中的问题,能否请您提供可以加载到驱动程序中的违规数据的转储,并提出问题?
谢谢。
关于mongodb - mgo $unwind 聚合结果到未知元素种类 (0x2E),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32716402/