[CSHARP-994] OData $expand and $top query options together with PageSize throws a MongoDB.Driver.MongoQueryException Created: 11/Jun/14  Updated: 08/Feb/23  Resolved: 04/May/15

Status: Closed
Project: C# Driver
Component/s: Linq
Affects Version/s: 1.9.1
Fix Version/s: 2.1

Type: Bug Priority: Major - P3
Reporter: Dimitar Moev Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

.NET 4.5


Issue Links:
Depends
depends on CSHARP-601 Linq to Aggregation Framework Closed
Epic Link: Rewrite Linq

 Description   

I have a OData controller with Get action which has a QueryableAttribute with set PageSize property:

[Queryable(PageSize=5000)]
public async Task<IHttpActionResult> Get([FromODataUri] Guid key)

{ return this.Ok(repository.All()); }

repository.All() - returns MongoQueryable

when I make a GET request to my OData controller with following query:
?$expand=Attributes&$top=10

I get MongoDB.Driver.MongoQueryException exception with message:
Skip and Take may only be used in conjunction with each other and cannot be separated by other operations.

If I remove $top or $expand option from my request or remove PegeSize from QueryableAttribute then I get successful response



 Comments   
Comment by Dimitar Moev [ 05/May/15 ]

I am using $expand to load and array of sub-documents. For example the
main documents is a TimeSeries which has Attribute property which is an
array.

{
"Attributes" : [

{ "Name" : "EntryExpiration", "SemanticRef" : "DateTime", "Value" : "9.00:00:00.000" }

],
"IsCumulative" : false,
"MeasureType" : 2,
"Name" : "NumericSeries1"
}

Sometimes the number of attributes could be very large, so I want to load
TimeSeries with (1) or without (2) the Attributes:

1. http://localhost/TimeSeries?$expand=Attributes

2. http://localhost/TimeSeries

Thanks
Dimitar

From:
"Craig Wilson (JIRA)" <jira@mongodb.org>
To:
dimitar.moev@schneider-electric.com,
Date:
05/04/2015 01:20 PM
Subject:
[MongoDB-JIRA] (CSHARP-994) OData $expand and $top query options together
with PageSize throws a MongoDB.Driver.MongoQueryException

[
https://jira.mongodb.org/browse/CSHARP-994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Craig Wilson closed CSHARP-994.
-------------------------------
Resolution: Fixed

This is fixed by CSHARP-601.

However, I notice the $expand in your url and, since MongoDB doesn't
support relationships between collections, I'm not sure how that is
getting used.

Craig

MongoDB.Driver.MongoQueryException
-------------------------------------------------------------------------------------------------------
with set PageSize property:
key)
be separated by other operations.
from QueryableAttribute then I get successful response

----------------------
This message was sent from MongoDB's issue tracking system. To respond to
this ticket, please login to https://jira.mongodb.org using your JIRA or
MMS credentials.

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________

Comment by Craig Wilson [ 04/May/15 ]

This is fixed by CSHARP-601.

However, I notice the $expand in your url and, since MongoDB doesn't support relationships between collections, I'm not sure how that is getting used.

Craig

Generated at Wed Feb 07 21:38:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.