You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's an issue with the MongoDB Driver, not MongoFramework.
I don't know if a query like that is actually possible in MongoDB. If it is, the MongoDB Driver that MongoFramework wraps doesn't support it - I do have an issue opened to replace the MongoDB Driver ( #54 ) which may allow me to work around the issue but that will be months and months of work.
Best you can do is raise an issue with the MongoDB driver team and see if either that type of query is impossible or whether the driver simply doesn't support it.
The issue can be reproduced here: https://github.com/dongshengfengniaowu/MongoFrameworkTest
{
"Code": 2,
"CodeName": "BadValue",
"Command": [
{
"Name": "aggregate",
"Value": "KC.Fengniaowu.Hebe.DeviceReadings"
},
{
"Name": "pipeline",
"Value": [
[
{
"Name": "$match",
"Value": [
{
"Name": "Enabled",
"Value": true
},
{
"Name": "DeviceId",
"Value": "1c4f0b54031a1798acae6b1ec47ec7eb"
},
{
"Name": "Success",
"Value": true
}
]
}
],
[
{
"Name": "$sort",
"Value": [
{
"Name": "ReadingTime",
"Value": -1
},
{
"Name": "CreateTime",
"Value": -1
}
]
}
],
[
{
"Name": "$limit",
"Value": 2
}
]
]
},
{
"Name": "cursor",
"Value": []
}
],
"ErrorMessage": "cannot sort with keys that are parallel arrays",
"Result": [
{
"Name": "ok",
"Value": 0
},
{
"Name": "errmsg",
"Value": "cannot sort with keys that are parallel arrays"
},
{
"Name": "code",
"Value": 2
},
{
"Name": "codeName",
"Value": "BadValue"
}
],
"ConnectionId": {
"ServerId": {
"ClusterId": {
"Value": 1
},
"EndPoint": {
"Host": "localhost",
"AddressFamily": 0,
"Port": 27017
}
},
"LocalValue": 2,
"ServerValue": 206
},
"ErrorLabels": [],
"StackTrace": " at MongoDB.Driver.Linq.MongoQueryProviderImpl
1.Execute(Expression expression)\r\n at MongoFramework.Infrastructure.Linq.MongoFrameworkQueryProvider
2.Execute(Expression expression) in E:\SourceCode\KC.Fengniaowu.Hebe\KC.Fengniaowu.Hebe\MongoFramework\Infrastructure\Linq\MongoFrameworkQueryProvider.cs:line 36\r\n at MongoFramework.Infrastructure.Linq.MongoFrameworkQueryable2.GetEnumerator()+MoveNext() in E:\\SourceCode\\KC.Fengniaowu.Hebe\\KC.Fengniaowu.Hebe\\MongoFramework\\Infrastructure\\Linq\\MongoFrameworkQueryable.cs:line 56\r\n at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)\r\n at test.Program.Main(String[] args) in E:\SourceCode\KC.Fengniaowu.Hebe\KC.Fengniaowu.Hebe\MongoTest\Program.cs:line 95","Message": "Command aggregate failed: cannot sort with keys that are parallel arrays.",
"Data": {},
"InnerException": null,
"HelpLink": null,
"Source": "MongoDB.Driver",
"HResult": -2146233088
}
The text was updated successfully, but these errors were encountered: