Skip to content

Commit fdfd82e

Browse files
committed
Changes
1 parent ae46a12 commit fdfd82e

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

source/fundamentals/linq.txt

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,9 @@ following documents:
323323
Nested Statements
324324
+++++++++++++++++
325325

326-
You can chain or nest ``Select`` and ``SelectMany`` statements. The examples
327-
in this section use the ``Guidebook`` class, which contain an array of ``Restaurant``
328-
objects. The following code shows an example of a document modeled by the
329-
``Guidebook`` class:
326+
You can chain or nest ``Select`` and ``SelectMany`` statements to unwind nested
327+
arrays. Consider a collection that holds documents with a ``restaurants`` field.
328+
This field contains an array of documents that represent the ``Restaurants`` class:
330329

331330
.. code-block:: json
332331

@@ -337,29 +336,36 @@ objects. The following code shows an example of a document modeled by the
337336
"_id": { ... } ,
338337
"address": { ... },
339338
"name": "Tov Kosher Kitchen",
339+
"grades": [
340+
{
341+
"date" : ISODate("2014-11-24T00:00:00Z"),
342+
"grade" : "Z",
343+
"score" : 20.0
344+
},
345+
{
346+
"date" : ISODate("2013-01-17T00:00:00Z"),
347+
"grade" : "A",
348+
"score" : 13.0
349+
},
350+
...
351+
]
340352
...
341353
},
342354
{
343355
"_id": { ... } ,
344356
"address": { ... },
345357
"name": "Harriet's Kitchen",
358+
"grades": [ ... ],
346359
...
347360
},
348361
...
349362
]
350363
}
351364

352-
The following code models the ``Guidebook`` class:
353-
354-
.. literalinclude:: /includes/fundamentals/code-examples/linq.cs
355-
:language: csharp
356-
:start-after: start-guidebook-model
357-
:end-before: end-guidebook-model
358-
359365
You can nest ``SelectMany`` statements within ``SelectMany`` or ``Select``
360366
statements. The following example nests a ``SelectMany`` statement within a
361-
``Select`` statement to retrieve an array of grades from all restaurants
362-
in a document modeled by the ``Guidebook`` class.
367+
``Select`` statement to retrieve an array of ``Grade`` documents from all restaurants
368+
in the document above.
363369

364370
.. io-code-block::
365371
:copyable: true

0 commit comments

Comments
 (0)