英文:
mgo $unwind aggregation result to Unknown element kind (0x2E)
问题
我有一个类似这样的聚合查询:
$ 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)
但是我收到了一个错误信息:
Unknown element kind (0x2E)
。
这是怎么回事?我的查询有问题吗?
英文:
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?
答案1
得分: 1
返回翻译的内容:
返回的错误指出传递给驱动程序的数据具有未知的元素类型。查看BSON规范,确实没有0x2E
元素类型:
如果您认为这是驱动程序中的问题,请提供一个可以加载到驱动程序中的有问题数据的转储,并提交一个问题报告。
谢谢。
英文:
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:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论