Skip to content

Add command alterCollection, initially to allow enabling "lexical" feature after creation #2468

@tatu-at-datastax

Description

@tatu-at-datastax

Currently settings of Collections are immutable after createCollection has created them.

But we need to be able to change some aspects, starting with ability to enable support for "lexical" (addition of column "$lexical" with analyzed text index).

For enabling lexical, no re-indexing occurs: it just allows use of $lexical field (via matching column) and indexing of newly inserted or updated Documents.

Command should be CollectionCommand to connect at same URL path as AlterTable, linked from CollectionResource, and take Collection Name as Path parameter.

Command should initially accept an Object argument with single entry -- "lexical" -- accepting same value type as createCollections "options.lexical" field. So:

  {
    "alterCollection": {
      "lexical": { "enabled": true, "analyzer": "standard" }
    }
  }

Q? Should this instead look more like "alterTable"? So:

{
  "alterCollection": {
    "operation": {
      "enableLexical": { "analyzer": "standard" }
    }
  }
}

For now, go with Option 1.

Only {"enabled": true} case is to be supported in the first phase.

Return value should be simple "ok":

"status": {
  "ok": 1
}

Command should:

  1. Fail if unrecognized root-level fields encountered (only "lexical" recognized)
  2. Fail if "lexical" was to be disabled
  3. Fail if "lexical" feature not enabled for the Database (same as for "CreateCollectionCommand")
  4. Succeed without action if "lexical" feature already enabled for Collection with same settings; fail if settings differ
  5. Try to:
    1. create "$lexical" column, create text-analyzed index for it (same as with "CreateCollectionCommand"), update "comment" of underlying Table
    2. Succeed if all above steps succeeded; fail otherwise

Note that this command does not have counterpart in MongoDB.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions