Skip to content

Commit bdf5231

Browse files
Merge pull request #4 from Meg528/patch-5
Update 2-SELECT.mdx
2 parents c2a9085 + e1ae6ae commit bdf5231

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/40-CRUD/2-SELECT.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ In SQL, the `SELECT` statement allows us to specify which columns to retrieve fr
88
db.collection.find({ <query> }, { projection })
99
```
1010

11-
## **Projection Basics**
11+
## **Projection basics**
1212

1313
- By default, MongoDB returns all fields in a document.
1414
- Use projection to **include (1)** or **exclude (0)** specific fields.
@@ -21,7 +21,7 @@ db.collection.find({ <query> }, { projection })
2121
db.books.find({}, { title: 1, authors: 1, _id: 0 });
2222
```
2323

24-
**Equivalent SQL Query:**
24+
**Equivalent SQL query:**
2525

2626
```sql
2727
SELECT title, authors FROM books;
@@ -40,7 +40,7 @@ Here:
4040
db.books.find({}, { reviews: 0 });
4141
```
4242

43-
**Equivalent SQL Query:**
43+
**Equivalent SQL query:**
4444

4545
```sql
4646
SELECT title, authors, genres, totalInventory, available FROM books;
@@ -52,13 +52,13 @@ Here:
5252

5353
---
5454

55-
## **Example 3: Using Projection along with a Query**
55+
## **Example 3: Using projection along with a query**
5656

5757
```js
5858
db.books.find({ genres: "Science" }, { title: 1, totalInventory: 1, _id: 0 });
5959
```
6060

61-
**Equivalent SQL Query:**
61+
**Equivalent SQL query:**
6262

6363
```sql
6464
SELECT title, totalInventory FROM books WHERE genres='Science';

0 commit comments

Comments
 (0)