From e1ae6ae37acc6f395745619abbdebd67dde109bc Mon Sep 17 00:00:00 2001 From: Meg528 <71841959+Meg528@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:42:45 -0700 Subject: [PATCH] Update 2-SELECT.mdx --- docs/40-CRUD/2-SELECT.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/40-CRUD/2-SELECT.mdx b/docs/40-CRUD/2-SELECT.mdx index 83d914a..c880684 100644 --- a/docs/40-CRUD/2-SELECT.mdx +++ b/docs/40-CRUD/2-SELECT.mdx @@ -8,7 +8,7 @@ In SQL, the `SELECT` statement allows us to specify which columns to retrieve fr db.collection.find({ }, { projection }) ``` -## **Projection Basics** +## **Projection basics** - By default, MongoDB returns all fields in a document. - Use projection to **include (1)** or **exclude (0)** specific fields. @@ -21,7 +21,7 @@ db.collection.find({ }, { projection }) db.books.find({}, { title: 1, authors: 1, _id: 0 }); ``` -**Equivalent SQL Query:** +**Equivalent SQL query:** ```sql SELECT title, authors FROM books; @@ -40,7 +40,7 @@ Here: db.books.find({}, { reviews: 0 }); ``` -**Equivalent SQL Query:** +**Equivalent SQL query:** ```sql SELECT title, authors, genres, totalInventory, available FROM books; @@ -52,13 +52,13 @@ Here: --- -## **Example 3: Using Projection along with a Query** +## **Example 3: Using projection along with a query** ```js db.books.find({ genres: "Science" }, { title: 1, totalInventory: 1, _id: 0 }); ``` -**Equivalent SQL Query:** +**Equivalent SQL query:** ```sql SELECT title, totalInventory FROM books WHERE genres='Science';