[DOCS-10530] Comment on: "manual/reference/sql-comparison" Created: 14/Jul/17  Updated: 30/Oct/23  Resolved: 26/Jul/18

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: collector-298ba4e7, docs-triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 10 x64, Chrome Version 59.0.3071.115 (Official Build) (64-bit)

Location: https://docs.mongodb.com/manual/reference/sql-comparison/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Referrer: https://www.google.com/
Screen Resolution: 1920 x 1200


Participants:
Days since reply: 5 years, 29 weeks ago

 Description   

Page Error: Typo

Section: Comparing SQL Statements to MongoDB find() Statements

Issue: The MongoDB find() examples for "SELECT id, user_id, status" and "SELECT user_id, status" are swapped in the table.

From the Page:

SELECT id,
user_id,
status
FROM people

Compares to:

db.people.find(
    { },
    { user_id: 1, status: 1 }
)

Where it should compare to:

db.people.find(
    { },
    { user_id: 1, status: 1, _id: 0 }
)

Likewise:

SELECT user_id, status
FROM people

Is compared to:

db.people.find(
    { },
    { user_id: 1, status: 1, _id: 0 }
)

and should be compared to:

db.people.find(
    { },
    { user_id: 1, status: 1 }
)



 Comments   
Comment by Kay Kim (Inactive) [ 26/Jul/18 ]

by default, the _id field is always returned.
To suppress the return of the _id field, you must specify _id: 0 <--- where 0 means not to return

So, a projection document of

{ user_id:1, status: 1 }

returns user_id, status, and _id
A proejction document of

{ user_id:1, status: 1, _id: 0 }

returns only user_id and status.

Generated at Thu Feb 08 08:00:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.