-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1681 from Danielle9897/RDoc-2475-NodeJs-countResults
RDoc-2475 Client API > Session > Querying > Count query results
- Loading branch information
Showing
22 changed files
with
554 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...on.Pages/client-api/session/querying/how-to-count-query-results.dotnet.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Count Query Results | ||
|
||
--- | ||
|
||
{NOTE: } | ||
|
||
* The following options are available to __count query results__: | ||
|
||
* [Count](../../../client-api/session/querying/how-to-count-query-results#count) | ||
|
||
* [LongCount](../../../client-api/session/querying/how-to-count-query-results#longcount) | ||
|
||
* [Get number of results from query stats](../../../client-api/session/querying/how-to-count-query-results#get-count-from-query-stats) | ||
|
||
{NOTE/} | ||
|
||
--- | ||
|
||
{PANEL: Count} | ||
|
||
* When the number of resulting items is expected to be an **`Int32`** variable, | ||
use `Count` in a synchronous session (or `CountAsync` in an async session). | ||
|
||
* `Count` is implemented in `System.Linq`. | ||
`CountAsync` is implemented in `Raven.Client.Documents`. | ||
|
||
* An `OverflowException` will be thrown if the number of items exceeds **`Int32.MaxValue`**. | ||
|
||
{NOTE: } | ||
|
||
{CODE-TABS} | ||
{CODE-TAB:csharp:Query count_1@ClientApi\Session\Querying\CountQueryResultsUsingLinq.cs /} | ||
{CODE-TAB:csharp:Query_async count_2@ClientApi\Session\Querying\CountQueryResults.cs /} | ||
{CODE-TAB:csharp:DocumentQuery count_3@ClientApi\Session\Querying\CountQueryResults.cs /} | ||
{CODE-TAB-BLOCK:sql:RQL} | ||
from "Orders" | ||
where ShipTo.Country == "UK" limit 0, 0 | ||
|
||
// The RQL generated will trigger query execution | ||
// however, no documents are returned (limit is set 0) | ||
{CODE-TAB-BLOCK/} | ||
{CODE-TABS/} | ||
|
||
{NOTE/} | ||
|
||
{PANEL/} | ||
|
||
{PANEL: LongCount} | ||
|
||
* When the number of resulting items is expected to be an **`Int64`** variable, | ||
use `LongCount` in a synchronous session (or `LongCountAsync` in an async session). | ||
|
||
* `LongCount` is implemented in both `Raven.Client.Documents` & `System.Linq` (use as needed). | ||
`LongCountAsync` is implemented in `Raven.Client.Documents`. | ||
|
||
{NOTE: } | ||
|
||
{CODE-TABS} | ||
{CODE-TAB:csharp:Query count_4@ClientApi\Session\Querying\CountQueryResults.cs /} | ||
{CODE-TAB:csharp:Query_async count_5@ClientApi\Session\Querying\CountQueryResults.cs /} | ||
{CODE-TAB:csharp:DocumentQuery count_6@ClientApi\Session\Querying\CountQueryResults.cs /} | ||
{CODE-TAB-BLOCK:sql:RQL} | ||
from "Orders" | ||
where ShipTo.Country == "UK" limit 0, 0 | ||
|
||
// The RQL generated will trigger query execution | ||
// however, no documents are returned (limit is set 0) | ||
{CODE-TAB-BLOCK/} | ||
{CODE-TABS/} | ||
|
||
{NOTE/} | ||
|
||
{PANEL/} | ||
|
||
{PANEL: Get count from query stats} | ||
|
||
* When executing a query, | ||
you can retrieve the query statistics which include the total number of results. | ||
|
||
* The number of results is available in the `QueryStatistics` object as: | ||
* `TotalResults` - an Int32 value | ||
* `LongTotalResults` - an Int64 value | ||
|
||
* Learn more in [Get Query Statistics](../../../client-api/session/querying/how-to-get-query-statistics). | ||
|
||
{PANEL/} | ||
|
||
## Related Articles | ||
|
||
### Client API | ||
|
||
- [Query overview](../../../client-api/session/querying/how-to-query) | ||
- [What is a Document Query](../../../client-api/session/querying/document-query/what-is-document-query) | ||
- [Filter by Field Presence](../../../client-api/session/querying/how-to-filter-by-field) | ||
- [Get Query Statistics](../../../client-api/session/querying/how-to-get-query-statistics) | ||
|
||
### Querying | ||
|
||
- [Filtering](../../../indexes/querying/filtering) | ||
- [RQL - Raven Query Language](../../../client-api/session/querying/what-is-rql) |
66 changes: 66 additions & 0 deletions
66
...tation.Pages/client-api/session/querying/how-to-count-query-results.js.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Count Query Results | ||
|
||
--- | ||
|
||
{NOTE: } | ||
|
||
* The following options are available to __count query results__: | ||
|
||
* [Count](../../../client-api/session/querying/how-to-count-query-results#count) | ||
|
||
* [Get number of results from query stats](../../../client-api/session/querying/how-to-count-query-results#get-count-from-query-stats) | ||
|
||
{NOTE/} | ||
|
||
--- | ||
|
||
{PANEL: Count} | ||
|
||
* Call `count` to get the number of items in the query results. | ||
|
||
* Method `longCount`, which is also available, produces exactly the same results as `count`. | ||
It is only included to be consistent with the .NET client. | ||
|
||
{NOTE: } | ||
|
||
{CODE-TABS} | ||
{CODE-TAB:nodejs:Query count@ClientApi\Session\Querying\countQueryResults.js /} | ||
{CODE-TAB-BLOCK:sql:RQL} | ||
from "Orders" | ||
where ShipTo.Country == "UK" limit 0, 0 | ||
|
||
// The RQL generated will trigger query execution | ||
// however, no documents are returned (limit is set 0) | ||
{CODE-TAB-BLOCK/} | ||
{CODE-TABS/} | ||
|
||
{NOTE/} | ||
|
||
{PANEL/} | ||
|
||
{PANEL: Get count from query stats} | ||
|
||
* When executing a query, | ||
you can retrieve the query statistics which include the total number of results. | ||
|
||
* The number of results is available in the `QueryStatistics` object as: | ||
* `totalResults` | ||
* `longTotalResults` | ||
|
||
* Learn more in [Get Query Statistics](../../../client-api/session/querying/how-to-get-query-statistics). | ||
|
||
{PANEL/} | ||
|
||
## Related Articles | ||
|
||
### Client API | ||
|
||
- [Query overview](../../../client-api/session/querying/how-to-query) | ||
- [What is a Document Query](../../../client-api/session/querying/document-query/what-is-document-query) | ||
- [Filter by Field Presence](../../../client-api/session/querying/how-to-filter-by-field) | ||
- [Get Query Statistics](../../../client-api/session/querying/how-to-get-query-statistics) | ||
|
||
### Querying | ||
|
||
- [Filtering](../../../indexes/querying/filtering) | ||
- [RQL - Raven Query Language](../../../client-api/session/querying/what-is-rql) |
100 changes: 0 additions & 100 deletions
100
...mentation.Pages/client-api/session/querying/how-to-count-query-results.markdown
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.