Skip to content

Commit

Permalink
Merge pull request #1667 from Danielle9897/RDoc-2451-NodeJs-lazyQuery
Browse files Browse the repository at this point in the history
RDoc-2451 [Node.js] Client API > Session > Querying > Lazy queries & requests
  • Loading branch information
ppekrol committed Jun 27, 2023
2 parents 3dce803 + 5a27a44 commit 3801d83
Show file tree
Hide file tree
Showing 54 changed files with 1,197 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
Loading entities with include can be executed __lazily__.

{CODE-TABS}
{CODE-TAB:csharp:Lazy-load-with-include lazy_LoadWithInclude@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TAB:csharp:The-document lazy_productClass@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TAB:csharp:Lazy_load_with_include lazy_LoadWithInclude@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TAB:csharp:The_document lazy_productClass@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TABS/}
{NOTE/}

Expand Down Expand Up @@ -70,7 +70,7 @@
{NOTE: }
<a id="runQuery" /> __Run query__

* A Query can be executing a __lazily__.
* A Query can be executed __lazily__.
Learn more about running queries lazily in [lazy queries](../../../client-api/session/querying/how-to-perform-queries-lazily).

{CODE lazy_Query@ClientApi\Session\HowTo\Lazy.cs /}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to Stream Query Results
# Stream Query Results

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to Stream Query Results
# Stream Query Results

Query results can be streamed using the `stream` method from the `advanced` session operations. The query can be issued using either a static index, or it can be a dynamic one where it will be handled by an auto index.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to Stream Query Results
# Stream Query Results

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
{
"Path": "perform-operations-lazily.markdown",
"Name": "...perform operations lazily",
"Name": "...perform requests lazily",
"DiscussionId": "7a54c2fc-67ee-40e6-94b5-1266e990cf57",
"Mappings": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
# How to Perform Operations Lazily

# Perform requests lazily
---

{NOTE: }

* **Defining a lazy operation** allows deferring the execution of the operation until it is needed.
* __Lazy request__:

* You can define a lazy request within a session (e.g. a lazy-query or a lazy-load request)
and defer its execution until actually needed.

* The lazy request definition is stored in the session and a `Lazy<T>` instance is returned.
The request will be sent to the server and executed only when you access the value of this instance.

* __Multiple lazy requests__:

* Multiple lazy requests can be defined within the same session.

* Multiple pending lazy operations can be executed together, see below.
* When triggering the deferred execution (whether implicitly or explicitly),
ALL pending lazy requests held up by the session will be sent to the server in a single call.
This can help reduce the number of remote calls made to the server over the network.

* In this page:
* [Operations that can be executed lazily](../../../client-api/session/how-to/perform-operations-lazily#operations-that-can-be-executed-lazily)
* [Load entities](../../../client-api/session/how-to/perform-operations-lazily#loadEntities)
* [Load entities with include](../../../client-api/session/how-to/perform-operations-lazily#loadWithInclude)
* [Load entities starting with](../../../client-api/session/how-to/perform-operations-lazily#loadStartingWith)
* [Conditional load](../../../client-api/session/how-to/perform-operations-lazily#conditionalLoad)
* [Run query](../../../client-api/session/how-to/perform-operations-lazily#runQuery)
* [Get revisions](../../../client-api/session/how-to/perform-operations-lazily#getRevisions)
* [Get compare-exchange value](../../../client-api/session/how-to/perform-operations-lazily#getCompareExchange)
* [Execute all pending lazy operations](../../../client-api/session/how-to/perform-operations-lazily#execute-all-pending-lazy-operations)
* [Requests that can be executed lazily:](../../../client-api/session/how-to/perform-operations-lazily#requests-that-can-be-executed-lazily)
* [Load entities](../../../client-api/session/how-to/perform-operations-lazily#loadEntities)
* [Load entities with include](../../../client-api/session/how-to/perform-operations-lazily#loadWithInclude)
* [Load entities starting with](../../../client-api/session/how-to/perform-operations-lazily#loadStartingWith)
* [Conditional load](../../../client-api/session/how-to/perform-operations-lazily#conditionalLoad)
* [Run query](../../../client-api/session/how-to/perform-operations-lazily#runQuery)
* [Get revisions](../../../client-api/session/how-to/perform-operations-lazily#getRevisions)
* [Get compare-exchange value](../../../client-api/session/how-to/perform-operations-lazily#getCompareExchange)
* [Multiple lazy requests](../../../client-api/session/how-to/perform-operations-lazily#multiple-lazy-requests)
* [Execute all requests - implicitly](../../../client-api/session/how-to/perform-operations-lazily#implicit)
* [Execute all requests - explicitly](../../../client-api/session/how-to/perform-operations-lazily#explicit)

{NOTE/}

{PANEL: Operations that can be executed lazily}
---

{PANEL: Requests that can be executed lazily}

{NOTE: }
<a id="loadEntities" /> __Load entities__
Expand All @@ -39,8 +54,8 @@
Loading entities with include can be executed __lazily__.

{CODE-TABS}
{CODE-TAB:csharp:Lazy-load-with-include lazy_LoadWithInclude@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TAB:csharp:The-document lazy_productClass@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TAB:csharp:Lazy_load_with_include lazy_LoadWithInclude@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TAB:csharp:The_document lazy_productClass@ClientApi\Session\HowTo\Lazy.cs /}
{CODE-TABS/}
{NOTE/}

Expand Down Expand Up @@ -70,8 +85,8 @@
{NOTE: }
<a id="runQuery" /> __Run query__

* A Query can be executing a __lazily__.
Learn more about running queries lazily in [lazy queries](../../../client-api/session/querying/how-to-perform-queries-lazily).
* A Query can be executed __lazily__.
Find more lazy queries examples in [perform a lazy query](../../../client-api/session/querying/how-to-perform-queries-lazily).

{CODE lazy_Query@ClientApi\Session\HowTo\Lazy.cs /}
{NOTE/}
Expand All @@ -94,11 +109,21 @@

{PANEL/}

{PANEL: Execute all pending lazy operations}
{PANEL: Multiple lazy requests }

{NOTE: }
<a id="implicit" /> __Execute all requests - implicitly__

{CODE lazy_ExecuteAll_Implicit@ClientApi\Session\HowTo\Lazy.cs /}

* Use `ExecuteAllPendingLazyOperations` to execute **all** pending lazy operations at once.
{NOTE/}

{CODE lazy_ExecuteAllPendingLazyOperations@ClientApi\Session\HowTo\Lazy.cs /}
{NOTE: }
<a id="explicit" /> __Execute all requests - explicitly__

{CODE lazy_ExecuteAll_Explicit@ClientApi\Session\HowTo\Lazy.cs /}

{NOTE/}

{PANEL/}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
# How to Perform Operations Lazily

# Perform requests lazily
---

{NOTE: }

* **Defining a lazy operation** allows deferring the execution of the operation until it is needed.
* __Lazy request__:

* You can define a lazy request within a session (e.g. a lazy-query or a lazy-load request)
and defer its execution until actually needed.

* The lazy request definition is stored in the session and a `Lazy` instance is returned.
The request will be sent to the server and executed only when you access the value of this instance.

* __Multiple lazy requests__:

* Multiple pending lazy operations can be executed together, see below.
* Multiple lazy requests can be defined within the same session.

* When triggering the deferred execution (whether implicitly or explicitly),
ALL pending lazy requests held up by the session will be sent to the server in a single call.
This can help reduce the number of remote calls made to the server over the network.

* In this page:
* [Operations that can be executed lazily](../../../client-api/session/how-to/perform-operations-lazily#operations-that-can-be-executed-lazily)
* [Load entities](../../../client-api/session/how-to/perform-operations-lazily#loadEntities)
* [Load entities with include](../../../client-api/session/how-to/perform-operations-lazily#loadWithInclude)
* [Load entities starting with](../../../client-api/session/how-to/perform-operations-lazily#loadStartingWith)
* [Conditional load](../../../client-api/session/how-to/perform-operations-lazily#conditionalLoad)
* [Run query](../../../client-api/session/how-to/perform-operations-lazily#runQuery)
* [Get revisions](../../../client-api/session/how-to/perform-operations-lazily#getRevisions)
* [Get compare-exchange value](../../../client-api/session/how-to/perform-operations-lazily#getCompareExchange)
* [Execute all pending lazy operations](../../../client-api/session/how-to/perform-operations-lazily#execute-all-pending-lazy-operations)
* [Requests that can be executed lazily:](../../../client-api/session/how-to/perform-operations-lazily#requests-that-can-be-executed-lazily)
* [Load entities](../../../client-api/session/how-to/perform-operations-lazily#loadEntities)
* [Load entities with include](../../../client-api/session/how-to/perform-operations-lazily#loadWithInclude)
* [Load entities starting with](../../../client-api/session/how-to/perform-operations-lazily#loadStartingWith)
* [Conditional load](../../../client-api/session/how-to/perform-operations-lazily#conditionalLoad)
* [Run query](../../../client-api/session/how-to/perform-operations-lazily#runQuery)
* [Get revisions](../../../client-api/session/how-to/perform-operations-lazily#getRevisions)
* [Get compare-exchange value](../../../client-api/session/how-to/perform-operations-lazily#getCompareExchange)
* [Multiple lazy requests](../../../client-api/session/how-to/perform-operations-lazily#multiple-lazy-requests)
* [Execute all requests - implicitly](../../../client-api/session/how-to/perform-operations-lazily#implicit)
* [Execute all requests - explicitly](../../../client-api/session/how-to/perform-operations-lazily#explicit)

{NOTE/}

---

{PANEL: Operations that can be executed lazily}

{NOTE: }
Expand All @@ -39,8 +54,8 @@
Loading entities with include can be executed __lazily__.

{CODE-TABS}
{CODE-TAB:nodejs:Lazy-load-with-include lazy_loadWithInclude@ClientApi\Session\HowTo\lazy.js /}
{CODE-TAB:nodejs:Sample-document lazy_productClass@ClientApi\Session\HowTo\lazy.js /}
{CODE-TAB:nodejs:Lazy_load_with_include lazy_loadWithInclude@ClientApi\Session\HowTo\lazy.js /}
{CODE-TAB:nodejs:The_document lazy_productClass@ClientApi\Session\HowTo\lazy.js /}
{CODE-TABS/}
{NOTE/}

Expand Down Expand Up @@ -70,7 +85,7 @@
{NOTE: }
<a id="runQuery" /> __Run query__

* A Query can be executing a __lazily__.
* A Query can be executed __lazily__.
Learn more about running queries lazily in [lazy queries](../../../client-api/session/querying/how-to-perform-queries-lazily).

{CODE:nodejs lazy_query@ClientApi\Session\HowTo\lazy.js /}
Expand All @@ -94,11 +109,21 @@

{PANEL/}

{PANEL: Execute all pending lazy operations}
{PANEL: Multiple lazy requests }

* Use `executeAllPendingLazyOperations` to execute **all** pending lazy operations at once.
{NOTE: }
<a id="implicit" /> __Execute all requests - implicitly__

{CODE:nodejs lazy_executeAllPendingLazyOperations@ClientApi\Session\HowTo\lazy.js /}
{CODE:nodejs lazy_ExecuteAll_Implicit@ClientApi\Session\HowTo\lazy.js /}

{NOTE/}

{NOTE: }
<a id="explicit" /> __Execute all requests - explicitly__

{CODE:nodejs lazy_ExecuteAll_Explicit@ClientApi\Session\HowTo\lazy.js /}

{NOTE/}

{PANEL/}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@

{NOTE: }

There are several methods with many overloads that allow users to download documents
from the database and convert them to entities. This article will cover the following
methods:

- [Load](../../client-api/session/loading-entities#load)
- [Load with Includes](../../client-api/session/loading-entities#load-with-includes)
- [Load - multiple entities](../../client-api/session/loading-entities#load---multiple-entities)
- [LoadStartingWith](../../client-api/session/loading-entities#loadstartingwith)
- [ConditionalLoad](../../client-api/session/loading-entities#conditionalload)
- [Stream](../../client-api/session/loading-entities#stream)
- [IsLoaded](../../client-api/session/loading-entities#isloaded)
* There are several methods that allow users to load documents from the database and convert them to entities.

* This article covers the following methods:

- [Load](../../client-api/session/loading-entities#load)
- [Load with Includes](../../client-api/session/loading-entities#load-with-includes)
- [Load - multiple entities](../../client-api/session/loading-entities#load---multiple-entities)
- [LoadStartingWith](../../client-api/session/loading-entities#loadstartingwith)
- [ConditionalLoad](../../client-api/session/loading-entities#conditionalload)
- [Stream](../../client-api/session/loading-entities#stream)
- [IsLoaded](../../client-api/session/loading-entities#isloaded)

* For loading entities lazily see [perform requests lazily](../../client-api/session/how-to/perform-operations-lazily).

{NOTE/}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# Session: Loading Entities
---

There are various methods with many overloads that allow users to download documents from a database and convert them to entities. This article will cover the following methods:
{NOTE: }

- [Load](../../client-api/session/loading-entities#load)
- [Load with Includes](../../client-api/session/loading-entities#load-with-includes)
- [Load - multiple entities](../../client-api/session/loading-entities#load---multiple-entities)
- [LoadStartingWith](../../client-api/session/loading-entities#loadstartingwith)
- [ConditionalLoad](../../client-api/session/loading-entities#conditionalload)
- [IsLoaded](../../client-api/session/loading-entities#isloaded)
- [Stream](../../client-api/session/loading-entities#stream)
* There are several methods that allow users to load documents from the database and convert them to entities.

* This article covers the following methods:

- [Load](../../client-api/session/loading-entities#load)
- [Load with Includes](../../client-api/session/loading-entities#load-with-includes)
- [Load - multiple entities](../../client-api/session/loading-entities#load---multiple-entities)
- [LoadStartingWith](../../client-api/session/loading-entities#loadstartingwith)
- [ConditionalLoad](../../client-api/session/loading-entities#conditionalload)
- [IsLoaded](../../client-api/session/loading-entities#isloaded)
- [Stream](../../client-api/session/loading-entities#stream)

* For loading entities lazily see [perform requests lazily](../../client-api/session/how-to/perform-operations-lazily).

{NOTE/}

---

{PANEL:Load}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
{
"Path": "how-to-stream-query-results.markdown",
"Name": "How to Stream Query Results",
"Name": "Stream Query Results",
"DiscussionId": "c96a370e-8d0d-4e8f-93b3-03a8105e8b0e",
"Mappings": [
{
Expand All @@ -39,7 +39,7 @@
},
{
"Path": "how-to-customize-query.markdown",
"Name": "How to Customize Query",
"Name": "Customize Query",
"DiscussionId": "73dfb483-1fca-4fca-a1a4-15c7366b4775",
"Mappings": []
},
Expand Down Expand Up @@ -77,7 +77,7 @@
},
{
"Path": "how-to-make-a-spatial-query.markdown",
"Name": "How to Make a Spatial Query",
"Name": "Make a Spatial Query",
"DiscussionId": "b62de172-77e9-4241-a525-9ba6cc027860",
"Mappings": [
{
Expand All @@ -98,13 +98,13 @@
},
{
"Path": "how-to-filter-by-field.markdown",
"Name": "How to Filter by Field Presence",
"Name": "Filter by Field Presence",
"DiscussionId": "bda0ec07-d0f9-46a0-bab7-ca733f692533",
"Mappings": []
},
{
"Path": "how-to-filter-by-non-existing-field.markdown",
"Name": "How to Filter by Non-Existing Field",
"Name": "Filter by Non-Existing Field",
"DiscussionId": "bda0ec07-d0f9-46a0-bab7-ca733f692533",
"Mappings": []
},
Expand All @@ -121,7 +121,7 @@
},
{
"Path": "how-to-perform-queries-lazily.markdown",
"Name": "How to Perform Queries Lazily",
"Name": "Perform a Lazy Query",
"DiscussionId": "a359f844-7193-4228-98e0-81a07e561a8b",
"Mappings": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[
{
"Path": "include-explanations.markdown",
"Name": "How to Include Query Explanations",
"Name": "Include Query Explanations",
"DiscussionId": "2d056281-2f65-4180-a3e1-a6348ec2d230",
"Mappings": []
},
{
"Path": "query-timings.markdown",
"Name": "How to Include Query Timings",
"Name": "Include Query Timings",
"DiscussionId": "873da629-f825-4378-bac9-87153227a41b",
"Mappings": []
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to Include Query Explanations
# Include Query Explanations

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to include Query Explanations
# Include Query Explanations

`includeExplanations` allows to investigate details related to score assigned for each query result.

Expand Down
Loading

0 comments on commit 3801d83

Please sign in to comment.