-
Notifications
You must be signed in to change notification settings - Fork 52
DOCSP-32718: add CodeWhisperer comments to collation code snippets #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
// start create collection with collation | ||
// Create the collection with a collation | ||
// Create the "souvenirs" collection and specify the French Canadian collation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. S: no periods for single line comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. applies throughout |
||
db.createCollection("souvenirs", { | ||
collation: { locale: "fr_CA" }, | ||
}); | ||
// end create collection with collation | ||
|
||
// start collection query without collation | ||
// Retrieve documents that match "photograph" in the "type" field. | ||
myColl.find({type: "photograph"}); | ||
// end collection query without collation | ||
|
||
// start collection query with collation | ||
/* | ||
Retrieve documents that match "photograph" in the "type" field, | ||
sorted by the Iceland collation and uppercase precedence. | ||
*/ | ||
myColl.find({type: "photograph"}, | ||
{ collation: { locale: "is", caseFirst: "upper" } } | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
/* | ||
Retrieve documents that match "New York" in the "city" field, | ||
sorted by the "name" field by using the German collation. | ||
*/ | ||
myColl.find({ city: "New York" }, { collation: { locale: "de" } }) | ||
.sort({ name: 1 }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
/* | ||
Create an index on the "title" field with the "en_US" | ||
locale collation, specifying ascending ordering of the | ||
"title" field. | ||
*/ | ||
myColl.createIndex( | ||
{ 'title' : 1 }, | ||
{ 'collation' : { 'locale' : 'en_US' } }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
// start query index collation | ||
/* | ||
Retrieve documents that match the "year" value "1980" | ||
in descending order of the value of the "title" field, | ||
specifying a collation that uses the index. | ||
*/ | ||
myColl.find({"year": 1980}, {"collation" : {"locale" : "en_US" }}) | ||
.sort({"title": -1}); | ||
// end query index collation | ||
|
||
// start query without index collation | ||
// no collation specified | ||
/* | ||
Retrieve documents that match the "year" value "1980" | ||
in descending order of the value of the "title" field | ||
that does not use the collation index. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: For this code comment and the next, is there a way to combine the code comments content so these aren't stacked? |
||
myColl.find({"year": 1980}) | ||
.sort({"title": -1}); | ||
|
||
// collation differs from the one on the index | ||
/* | ||
Retrieve documents that match the "year" value "1980" | ||
in descending order of the value of the "title" field, | ||
specifying a collation that does not use the collation | ||
index. | ||
*/ | ||
myColl.find({"year": 1980}, {"collation" : {"locale" : "en_US", "strength": 2 }}) | ||
.sort({"title": -1}); | ||
// end query without index collation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: since this comment is causing horizontal scroll, make it a multi line comment. Or, could it be more beneficial to comment before the each stage + the collation line?