Does QBO v3 QueryService limit responses to 100 rows? Can I set a higher limit? - intuit-partner-platform

I am using QueryService to retrieve a list of customers. This seems to limit the number of returned rows to 100 rows, maximum.
Here is my code:
QueryService<Intuit.Ipp.Data.Customer> customerQueryService = new QueryService<Intuit.Ipp.Data.Customer>(serviceContext);
List<Intuit.Ipp.Data.Customer> customers = customerQueryService.Select(c => c).ToList();
How do I set a higher limit for the maximum number of returned rows?

https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/020_key_concepts/00300_query_operations
Maximum Number of Entities in a Response
The maximum number of entities that can be returned in a response is 1000. If the result size is not specified, the default number is 100. If a query returns many entities, fetch the entities in chunks, as described in Pagination. To determine the number of entities that a particular query returns, probe by using the COUNT keyword in the query. See Count for details.

Related

Query using "LIMIT" still warns about result set with more than 10000 records

I have a simple model where I have a CLIENT class. Nodes from CLIENT can have a relationship OWS_MONEY_TO to another CLIENT. That's it.
With this setup, I created 10 million CLIENT nodes and 50 million random relationships of OWS_MONEY_TO within random CLIENTS.
When I run this query:
MATCH
{class:CLIENT, as:A}-OWS_MONEY_TO->{class:CLIENT, as:B}
RETURN A.name as Payer, B.name as Receiver limit 10
I hit this error:
Query 'SELECT FROM CLIENT' returned a result set with more than 10000 records.
Check if you really need all these records, or reduce the resultset by using a
LIMIT to improve both performance and used RAM
I'm using a limit already, as you may see, and I haven't been able to figure out how to get any result from this query.

Why mongo db (version 3.0.6) returns wrong number of records when we use count with limit option?

As per mongo db doc says we can use count with limit.
Limit option is used to specify the maximum number of documents the cursor will return. But if we use limit with count it returns total count and not correct count.
Why?
Suppose we have 50 records in collection then only count option will return 50, and if we apply limit(10) option then it should return 10 and not 50. But count with limit returns 50.
db.collection.find(<query>).count();
You will get count of all records found after executing the query. i.e count=50;
db.collection.find(<query>).limit(10).count(true);
You will get the count of limited documents. i.e count=10.
You should set applySkipLimit to true.
http://docs.mongodb.org/manual/reference/method/cursor.count/

Get records from db within a limit range

Assume that my database returns 1000 records based on a query that I have.
What I wish to do is using the same query, get the first 100 records, then get the next 100 and so on until I have all the 1000.
That is, I do not want all the 100 records in one go. I need them in batches of 100.
So something like this perhaps:
query = {
'$from': 0,
'$to': 100
}
with the first request followed by
query = {
'$from': 100,
'$to': 200
}
for the next request and so on.
I don't want all 1000 results at once. I wish to be able to specify the start and end counts so that I get the result in batches - is this possible in mongodb?
You could use skip and limit for your queries.
For example..
db.myCollection.find().limit(100) //Get the first 100 records
db.myCollection.find().skip(100).limit(100) //Get the next 100 records
This is an expensive method though, I would much rather get all 1000 and "separate" them client-side.
Here's a link to both method's docs
http://docs.mongodb.org/manual/reference/method/cursor.skip/
http://docs.mongodb.org/manual/reference/method/cursor.limit/

How to remove documents from a single collection that exceeds a certain limit

I'm currently replacing a big MySQL join-table with a MongoDB collection. One of the queries performed on the old MySQL table was limiting the amount of records for a certain key (exclusive join on a LIMIT ORDER BY record-set). But how to do this in MongoDB?
Many thanks in advance!
You can use sort({key:1}) to do order by (use -1 instead of 1 for descending order) and limit(N) to limit the returned result to N documents.
If instead you want to get all except the top N documents you would use:
db.collection.find({user:"X"}).sort({key:-1}).skip(1000)
This will return all the documents except the top 1000 sorted by key.

In Mongodb, how do I get the count of the total results returned, without the limit?

Let's say i put a limit and skip on the MongoDB query...I want to know the total results if there was not a limit on there.
Of course, I could do this the shitty way...which is to query twice.
In MongoDB the default behavior of count() is to ignore skip and limit and count the number of results in the entire original query. So running count will give you exactly what you want.
Passing a Boolean true to count or calling size instead would give you a count WITH skip or limit.
There is no way to get the count without executing the query twice.