mgo $将聚合结果展开为未知元素种类(0x2E)

编程入门 行业动态 更新时间:2024-10-23 21:24:43
本文介绍了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 解决方案

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

bsonspec/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:

bsonspec/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)

本文发布于:2023-11-22 15:10:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1617918.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:种类   元素   mgo   x2E

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!