我有这样的聚合查询
$ 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)
发布评论