Skip to content

Commit c2a9085

Browse files
Merge pull request #5 from Meg528/patch-7
Update 3-ORDER-LIMIT.mdx
2 parents 74176cc + 2873583 commit c2a9085

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/40-CRUD/3-ORDER-LIMIT.mdx

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ In SQL, we use `ORDER BY` to sort query results and `LIMIT` to restrict the numb
1010
- `{ field: -1 }`**Descending order** (Z → A, largest to smallest)
1111
- You can sort by multiple fields, just like SQL.
1212

13-
## **Limiting Results**
13+
## **Limiting results**
1414

1515
- `.limit(n)` restricts the number of documents returned.
1616
- Used together with `.sort()`, it helps fetch the **top N** results.
1717

1818
---
1919

20-
### 1: Top 5 Books with the Highest Inventory
20+
### 1: Top 5 books with the highest inventory
2121

2222
```js
2323
db.books.find().sort({ totalInventory: -1 }).limit(5);
2424
```
2525

26-
**Equivalent SQL Query:**
26+
**Equivalent SQL query:**
2727

2828
```sql
2929
SELECT * FROM books ORDER BY totalInventory DESC LIMIT 5;
@@ -33,7 +33,7 @@ This fetches the **5 books with the highest stock**.
3333

3434
---
3535

36-
### 2: Get the title of top 10 Fiction Books by highest page count
36+
### 2: Get the title of top 10 fiction books by highest page count
3737

3838
```js
3939
db.books
@@ -44,11 +44,11 @@ db.books
4444

4545
:::info
4646

47-
Along with the title, we fetched pages as well to ensure that we are getting the right results.
47+
Along with the title, we fetched pages, as well, to ensure that we are getting the right results.
4848

4949
:::
5050

51-
**Equivalent SQL Query:**
51+
**Equivalent SQL query:**
5252

5353
```sql
5454
SELECT title, pages FROM books WHERE genres='Fiction' ORDER BY pages DESC LIMIT 10;

0 commit comments

Comments
 (0)