Skip to content

Conversation

@pdohogne-magento
Copy link
Collaborator

Description

Committing aio app db commands to main

Related Issue

CEXT-5230: Deploy CLI DB App to Staging

Motivation and Context

Release aio app db commands

How Has This Been Tested?

Unit and manual tests, see PRs #12 - #26

Screenshots (if appropriate):

image image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Simran Gulati and others added 30 commits June 25, 2025 18:54
Co-authored-by: Peter Dohogne <pdohogne@adobe.com>
feat:cext-4860 added standalone commands
@nofuss
Copy link
Collaborator

nofuss commented Oct 27, 2025

  • aliases (edited my previous comment): collection|col index|ind document|doc

agreed - collection can get tiring to type

  • QUESTION? does it make sense to infer the current collection? so that we don't need to pass COLLECTION as an argument (especially for all the doc commands) we could use a flag instead --collection to overwrite the current one in context. it could be set via an env variable AIO_DB_COLLECTION

I think this would be a stretch. It would be comparable to having a "current table" in SQL, and that is hard to imagine. I honestly think adding the idea of a "current collection" would be more confusing than convenient.

  • is aio app db show collections an alias for aio app db collection list?

yes. I included show collections mainly because it is so common in mongosh that I can imagine people typing it out of instinct.

@moritzraho
Copy link
Member

I think this would be a stretch. It would be comparable to having a "current table" in SQL, and that is hard to imagine. I honestly think adding the idea of a "current collection" would be more confusing than convenient.

sounds good 🤝

@nofuss
Copy link
Collaborator

nofuss commented Oct 28, 2025

My take on defaults for one vs many document operations:

  • find: default to many
  • all others: default to one (safety first!)

Make sense for everybody?

@moritzraho
Copy link
Member

moritzraho commented Oct 28, 2025

Make sense for everybody?

makes sense, so you would control many insert/deletes/.. through a flag (--many) + multiple args?

@nofuss
Copy link
Collaborator

nofuss commented Oct 28, 2025

Make sense for everybody?

makes sense, so you would control many insert/deletes/.. through a flag (--many) + multiple args?

The --many flag is more about how many documents are affected. Both updateOne and updateMany, for example, have basically the same args, but updateMany will update however many documents are matched by the filter, but updateOne will update one and only one document, even if the filter matches multiple documents.

As for insert, we could make that simpler. If one document is provided, use insertOne, if a list of documents is provided, insertMany (no flag needed).

@pdohogne-magento
Copy link
Collaborator Author

Luckily combining find and findOne just means removing the latter, as finding only a single document can be achieved by passing --limit 1 to the find command 😄

Copy link
Member

@moritzraho moritzraho left a comment

Choose a reason for hiding this comment

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

cleaan!!

lgtm :)
just one small comment

]

DeleteOne.args = {
Delete.args = {
Copy link
Member

Choose a reason for hiding this comment

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

should this take a many flag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

At Manik's request we are not including deleteMany functionality in the CLI

Copy link
Collaborator

@AjazSumaiya AjazSumaiya left a comment

Choose a reason for hiding this comment

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

nice work @pdohogne-magento , looks good

package.json Outdated
{
"name": "@adobe/aio-cli-plugin-app-storage",
"version": "1.1.0",
"version": "1.2.0-alpha.1",
Copy link
Member

Choose a reason for hiding this comment

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

The version should be modified by an explicit release job. We will need to manage the pre version, and the dependency in a branch until we go GA

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.

7 participants