mgo $将聚合结果展开为未知元素种类(0x2E) [英] mgo $unwind aggregation result to Unknown element kind (0x2E)

查看:443
本文介绍了mgo $将聚合结果展开为未知元素种类(0x2E)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的聚合查询



$ db.histories.aggregate([{$ match:{issue_id:{$在:IDS}, history_comment:{$存在:真,$不是:{$尺寸:0}}}},{$展开: $ history_comment}])



使用 mgo
$转换为 go

  var h []历史
查询:= [] 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 $ b $ p $未知的元素种类(0x2E)
这怎么可能?是我的查询错误?

解决方案

返回的错误指出交给驱动程序的数据具有未知元素种类。看看BSON规范,那里确实没有 0x2E 元素种类:



http://bsonspec.org/spec.html



如果你认为这样是驱动程序中的一个问题,您能否提供可以加载到驱动程序中的有问题数据的转储,并打开它的问题?



谢谢。

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?

解决方案

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.

这篇关于mgo $将聚合结果展开为未知元素种类(0x2E)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆