[DOCS-7624] Comment on: "manual/reference/sql-comparison.txt" Created: 12/Apr/16  Updated: 30/Oct/23  Resolved: 12/Apr/16

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

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Ravind Kumar (Inactive)
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: https://docs.mongodb.org/manual/reference/sql-comparison/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Referrer: https://docs.mongodb.org/manual/core/read-operations-introduction/
Screen Resolution: 1440 x 900
repo: docs
source: reference/sql-comparison


Participants:
Days since reply: 7 years, 44 weeks, 1 day ago

 Description   

Hi team,

I think there is a problem with the below description.
MongoDB query
db.users.find(
{ },

{ user_id: 1, status: 1 }

) should translate to SQL query like
SELECT
user_id,
status
FROM users

The description on the reference page says like below:
SELECT id,
user_id,
status
FROM users

I dont understand why id is included in the select clause. Please clarify



 Comments   
Comment by Githook User [ 12/Apr/16 ]

Author:

{u'username': u'rkumar-mongo', u'name': u'ravind', u'email': u'ravind.kumar@10gen.com'}

Message: DOCS-7624: Add Note about _id in SQL vs Mongo

Signed-off-by: kay <kay.kim@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/2fe377a0723271ca3c85f8f79a4b451e4dce5b3e

Comment by Ravind Kumar (Inactive) [ 12/Apr/16 ]

Hello Amishi,

In MongoDB, the _id field is always included returned documents unless specifically excluded through projection. As of such, the equivalent SQL SELECT statement would need to include the _id field in order to return the same results.

Thanks for letting us know about this point of confusion.

Generated at Thu Feb 08 07:54:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.