Skip to content

CLOUDP-164347: Add --flag file to the atlas cluster index create command #2768

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

Merged
merged 12 commits into from
Mar 14, 2024

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Mar 13, 2024

Proposed changes

Jira ticket: CLOUDP-164347

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated test/README.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

Further comments

./bin/atlas cluster index create --help                                                                                                                          1.22.1  16.18.0
To use this command, you must authenticate with a user account or an API key with the Project Data Access Admin role.

Usage:
  atlas clusters indexes create [indexName] [flags]

Examples:
  # Create an index named bedrooms_1 on the listings collection of the realestate database:
  atlas clusters indexes create bedrooms_1 --clusterName Cluster0 --collection listings --db realestate --key bedrooms:1

  # Create a compound index named property_room_bedrooms on the
  listings collection of the realestate database:
  atlas clusters indexes create property_room_bedrooms --clusterName Cluster0 --collection listings --db realestate --key property_type:1 --key room_type:1 --key bedrooms:1

  # Create an index named my_index from a JSON configuration file named myfile.json:
  atlas clusters indexes create my_index --file file.json

Flags:
      --clusterName string   Name of the cluster.
      --collection string    Name of the collection.
      --db string            Name of the database.
  -f, --file string          Path to an optional JSON configuration file that defines index settings.
  -h, --help                 help for create
      --key strings          Field to be indexed and the type of index in the following format: field:type.
      --projectId string     Hexadecimal string that identifies the project to use. This option overrides the settings in the configuration file or environment variable.
      --sparse               Flag that creates a sparse index. To learn more, see https://dochub.mongodb.org/core/index-sparse-manual.

Global Flags:
  -P, --profile string   Name of the profile to use from your configuration file. To learn about profiles for the Atlas CLI, see https://dochub.mongodb.org/core/atlas-cli-save-connection-settings.
./bin/atlas cluster index create testIndex1 --collection listingsAndReviews --db sample_airbnb --clusterName ClusterM10test --key notes:1                     
Your index is being created
cat ~/Downloads/atlas_cluster_index_create_test.json                                                                                                         
{
  "collation": {
    "alternate": "non-ignorable",
    "backwards": false,
    "caseFirst": "lower",
    "caseLevel": false,
    "locale": "af",
    "maxVariable": "punct",
    "normalization": false,
    "numericOrdering": false,
    "strength": 3
  },
  "collection": "accounts",
  "db": "sample_airbnb",
  "keys": [
    {
      "property_type": "1",
      "room_type": "1"
    }
  ],
  "options": {
    "name": "PartialIndexTest",
    "partialFilterExpression":{
    	"limit": {"$gt": 900}
    }
  }

./bin/atlas cluster index create --file ~/Downloads/atlas_cluster_index_create_test.json --clusterName ClusterM10test                                       
Your index is being created

@andreaangiolillo andreaangiolillo marked this pull request as ready for review March 13, 2024 16:03
@andreaangiolillo andreaangiolillo requested a review from a team as a code owner March 13, 2024 16:03
@andreaangiolillo andreaangiolillo requested a review from a team March 13, 2024 16:03
@@ -107,6 +107,7 @@ dbName and collection are required only for built-in roles.`
MaxDate = "Maximum created date. This option returns events whose created date is less than or equal to the specified value."
MinDate = "Minimum created date. This option returns events whose created date is greater than or equal to the specified value."
ClusterFilename = "Path to an optional JSON configuration file that defines cluster settings. To learn more about cluster configuration files for the Atlas CLI, see https://dochub.mongodb.org/core/cluster-config-file-atlascli. To learn more about cluster configuration files for MongoCLI, see https://dochub.mongodb.org/core/mms-cluster-settings-file-mcli."
IndexFilename = "Path to an optional JSON configuration file that defines index settings."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you intend to have documentation for the file structure? if so make sure to ask for a dochub link and add it here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need the doc team to create the doc page and then we can update the description here. Let me know if I am missing something

Copy link
Collaborator

@fmenezes fmenezes Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can have the link ahead of time if you ask them and once the page is up they redirect it. we've done this way before

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can alternatively open a docsp ticket and ask them to update this line, make sure to add a link to where they should add the link if that is the approach you prefer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we cannot use the example in the open api spec (it does not work) and I haven't found any examples in the doc. The doc team will need to use the files in the data folders included in this PR 😭

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarahsimpers FYI as I think you've done some work here recently on the config files for the CLI.

fmenezes
fmenezes previously approved these changes Mar 13, 2024
Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jwilliams-mongo jwilliams-mongo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreaangiolillo copy lgtm but I'd like Sarah to chime in on the config file issue

@andreaangiolillo andreaangiolillo merged commit 17598c6 into master Mar 14, 2024
@andreaangiolillo andreaangiolillo deleted the CLOUDP-164347 branch March 14, 2024 09:12
@andreaangiolillo
Copy link
Collaborator Author

andreaangiolillo commented Mar 14, 2024

I created https://jira.mongodb.org/browse/DOCSP-37703 and included a description of what we will need on the doc side

@fmenezes fmenezes mentioned this pull request Apr 5, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants