Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot sort with keys that are parallel arrays #70

Closed
dongshengfengniaowu opened this issue May 28, 2019 · 1 comment
Closed

cannot sort with keys that are parallel arrays #70

dongshengfengniaowu opened this issue May 28, 2019 · 1 comment
Labels

Comments

@dongshengfengniaowu
Copy link

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.MongoQueryProviderImpl1.Execute(Expression expression)\r\n at MongoFramework.Infrastructure.Linq.MongoFrameworkQueryProvider2.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.List1..ctor(IEnumerable1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable1 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
}

@Turnerj
Copy link
Member

Turnerj commented May 28, 2019

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.

@Turnerj Turnerj closed this as completed May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants