mongodb - mgo $unwind 聚合结果到未知元素种类 (0x2E)

标签 mongodb go aggregation-framework mgo

我有一个这样的聚合查询

$ 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 元素类型:

http://bsonspec.org/spec.html

如果您认为这是驱动程序中的问题,能否请您提供可以加载到驱动程序中的违规数据的转储,并提出问题?

谢谢。

关于mongodb - mgo $unwind 聚合结果到未知元素种类 (0x2E),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32716402/

相关文章:

node.js - $push 聚合的限制

go - 使用去范围变量的内存地址是否安全?

go - 为什么存储在接口(interface)中的值在 Golang 中不可寻址

go - 获取写入文件的字节的偏移量/位置

mongodb - 将集合聚合并插入到mongodb中的不同集合中

mongoDB 有没有办法让聚合 $gte 不显示错误数据

MongoDB 索引确定以最大化性能和最小化索引

mongodb - 初始化应用程序时出错 : No datastore implementation specified Message: No datastore implementation specified

database - 与基于磁盘的 NoSQL 数据库相比,内存数据库的主要性能优势是什么?

node.js - 使用 Mongoose 在 Koa 中从流式查询中编写流式响应