Skip to content

Commit 4a00539

Browse files
authored
Merge pull request #246978 from seesharprun/patch-1
Cosmos DB | Update NoSQL query LINQ to NoSQL
2 parents e869fd6 + 9ead2b7 commit 4a00539

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

articles/cosmos-db/nosql/query/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,6 @@
415415
- name: Pagination
416416
displayName: continuation tokens, paging, pagination
417417
href: pagination.md
418-
- name: LINQ to SQL
418+
- name: LINQ to NoSQL
419419
displayName: linq, .NET
420420
href: linq-to-sql.md

articles/cosmos-db/nosql/query/linq-to-sql.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: LINQ to SQL translation
2+
title: LINQ to NoSQL translation
33
titleSuffix: Azure Cosmos DB for NoSQL
4-
description: Learn the LINQ operators supported and how the LINQ queries are mapped to SQL queries in Azure Cosmos DB.
4+
description: Learn the LINQ operators supported and how the LINQ queries are mapped to NoSQL queries in Azure Cosmos DB.
55
author: jcodella
66
ms.author: jacodel
77
ms.reviewer: sidandrews
@@ -12,11 +12,11 @@ ms.date: 07/31/2023
1212
ms.custom: query-reference
1313
---
1414

15-
# LINQ to SQL translation in Azure Cosmos DB for NoSQL
15+
# LINQ to NoSQL translation in Azure Cosmos DB for NoSQL
1616

1717
[!INCLUDE[NoSQL](../../includes/appliesto-nosql.md)]
1818

19-
The Azure Cosmos DB query provider performs a best effort mapping from a LINQ query into an Azure Cosmos DB SQL query. If you want to get the SQL query that is translated from LINQ, use the `ToString()` method on the generated `IQueryable` object. The following description assumes a basic familiarity with [LINQ](/dotnet/csharp/programming-guide/concepts/linq/introduction-to-linq-queries). In addition to LINQ, Azure Cosmos DB also supports [Entity Framework Core](/ef/core/providers/cosmos/?tabs=dotnet-core-cli), which works with API for NoSQL.
19+
The Azure Cosmos DB query provider performs a best effort mapping from a LINQ query into an Azure Cosmos DB for NoSQL query. If you want to get the NoSQL query that is translated from LINQ, use the `ToString()` method on the generated `IQueryable` object. The following description assumes a basic familiarity with [LINQ](/dotnet/csharp/programming-guide/concepts/linq/introduction-to-linq-queries). In addition to LINQ, Azure Cosmos DB also supports [Entity Framework Core](/ef/core/providers/cosmos/?tabs=dotnet-core-cli), which works with API for NoSQL.
2020

2121
> [!NOTE]
2222
> We recommend using the latest [.NET SDK (`Microsoft.Azure.Cosmos`) version](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/)
@@ -93,10 +93,10 @@ while (setIterator.HasMoreResults)
9393

9494
## Supported LINQ operators
9595

96-
The LINQ provider included with the SQL .NET SDK supports the following operators:
96+
The LINQ provider included with the NoSQL .NET SDK supports the following operators:
9797

9898
- **Select**: Projections translate to [SELECT](select.md), including object construction.
99-
- **Where**: Filters translate to [WHERE](where.md), and support translation between `&&`, `||`, and `!` to the SQL operators
99+
- **Where**: Filters translate to [WHERE](where.md), and support translation between `&&`, `||`, and `!` to the NoSQL operators
100100
- **SelectMany**: Allows unwinding of arrays to the [JOIN](join.md) clause. Use to chain or nest expressions to filter on array elements.
101101
- **OrderBy** and **OrderByDescending**: Translate to [ORDER BY](order-by.md) with ASC or DESC.
102102
- **Count**, **Sum**, **Min**, **Max**, and **Average** operators for aggregation, and their async equivalents **CountAsync**, **SumAsync**, **MinAsync**, **MaxAsync**, and **AverageAsync**.
@@ -125,7 +125,7 @@ The syntax is `input.Select(x => f(x))`, where `f` is a scalar expression. The `
125125
input.Select(family => family.parents[0].familyName);
126126
```
127127

128-
- **SQL**
128+
- **NoSQL**
129129

130130
```sql
131131
SELECT VALUE f.parents[0].familyName
@@ -140,7 +140,7 @@ The syntax is `input.Select(x => f(x))`, where `f` is a scalar expression. The `
140140
input.Select(family => family.children[0].grade + c); // c is an int variable
141141
```
142142

143-
- **SQL**
143+
- **NoSQL**
144144

145145
```sql
146146
SELECT VALUE f.children[0].grade + c
@@ -159,7 +159,7 @@ The syntax is `input.Select(x => f(x))`, where `f` is a scalar expression. The `
159159
});
160160
```
161161

162-
- **SQL**
162+
- **NoSQL**
163163

164164
```sql
165165
SELECT VALUE {
@@ -179,7 +179,7 @@ The syntax is `input.SelectMany(x => f(x))`, where `f` is a scalar expression th
179179
input.SelectMany(family => family.children);
180180
```
181181

182-
- **SQL**
182+
- **NoSQL**
183183

184184
```sql
185185
SELECT VALUE child
@@ -198,7 +198,7 @@ The syntax is `input.Where(x => f(x))`, where `f` is a scalar expression, which
198198
input.Where(family=> family.parents[0].familyName == "Wakefield");
199199
```
200200

201-
- **SQL**
201+
- **NoSQL**
202202

203203
```sql
204204
SELECT *
@@ -216,7 +216,7 @@ The syntax is `input.Where(x => f(x))`, where `f` is a scalar expression, which
216216
family.children[0].grade < 3);
217217
```
218218

219-
- **SQL**
219+
- **NoSQL**
220220

221221
```sql
222222
SELECT *
@@ -225,7 +225,7 @@ The syntax is `input.Where(x => f(x))`, where `f` is a scalar expression, which
225225
AND f.children[0].grade < 3
226226
```
227227

228-
## Composite SQL queries
228+
## Composite NoSQL queries
229229

230230
You can compose the preceding operators to form more powerful queries. Since Azure Cosmos DB supports nested containers, you can concatenate or nest the composition.
231231

@@ -242,7 +242,7 @@ The syntax is `input(.|.SelectMany())(.Select()|.Where())*`. A concatenated quer
242242
.Where(parent => parent.familyName == "Wakefield");
243243
```
244244

245-
- **SQL**
245+
- **NoSQL**
246246

247247
```sql
248248
SELECT *
@@ -259,7 +259,7 @@ The syntax is `input(.|.SelectMany())(.Select()|.Where())*`. A concatenated quer
259259
.Select(family => family.parents[0].familyName);
260260
```
261261

262-
- **SQL**
262+
- **NoSQL**
263263

264264
```sql
265265
SELECT VALUE f.parents[0].familyName
@@ -276,7 +276,7 @@ The syntax is `input(.|.SelectMany())(.Select()|.Where())*`. A concatenated quer
276276
Where(anon=> anon.grade < 3);
277277
```
278278

279-
- **SQL**
279+
- **NoSQL**
280280

281281
```sql
282282
SELECT *
@@ -293,7 +293,7 @@ The syntax is `input(.|.SelectMany())(.Select()|.Where())*`. A concatenated quer
293293
.Where(parent => parents.familyName == "Wakefield");
294294
```
295295

296-
- **SQL**
296+
- **NoSQL**
297297

298298
```sql
299299
SELECT *
@@ -316,7 +316,7 @@ A nested query applies the inner query to each element of the outer container. O
316316
family.parents.Select(p => p.familyName));
317317
```
318318

319-
- **SQL**
319+
- **NoSQL**
320320

321321
```sql
322322
SELECT VALUE p.familyName
@@ -333,7 +333,7 @@ A nested query applies the inner query to each element of the outer container. O
333333
family.children.Where(child => child.familyName == "Jeff"));
334334
```
335335

336-
- **SQL**
336+
- **NoSQL**
337337

338338
```sql
339339
SELECT *
@@ -351,7 +351,7 @@ A nested query applies the inner query to each element of the outer container. O
351351
child => child.familyName == family.parents[0].familyName));
352352
```
353353

354-
- **SQL**
354+
- **NoSQL**
355355

356356
```sql
357357
SELECT *

0 commit comments

Comments
 (0)