Closed amorton closed 1 week ago
claiming this guy as an easy ticket to bang out with limited time
Improved error for a command against a table:
{
"errors": [
{
"message": "The command is not supported by Tables in the API. \n\nWhile many commands operate on both Tables and Collections, some commands can only be run against Tables or Collections. \n\nThe commands supported by tables are: alterTable, createIndex, createVectorIndex, deleteMany, deleteOne, find, findOne, insertMany, insertOne, listIndexes, updateOne.\nThe commands supported by collections are: countDocuments, deleteMany, deleteOne, estimatedDocumentCount, find, findOne, findOneAndDelete, findOneAndReplace, findOneAndUpdate, insertMany, insertOne, updateMany, updateOne.\n\nThe unsupported command ran against the table: demo.users\nThe unsupported command was: updateMany.\n\nResend using one of the supported commands.",
"scope": "",
"errorCode": "UNSUPPORTED_TABLE_COMMAND",
"id": "a4623d40-bb14-4213-9cff-c959bd9d9a94",
"family": "REQUEST",
"title": "Commands is not supported by Tables"
}
]
}
message text
The command is not supported by Tables in the API.
While many commands operate on both Tables and Collections, some commands can only be run against Tables or Collections.
The commands supported by tables are: alterTable, createIndex, createVectorIndex, deleteMany, deleteOne, find, findOne, insertMany, insertOne, listIndexes, updateOne.
The commands supported by collections are: countDocuments, deleteMany, deleteOne, estimatedDocumentCount, find, findOne, findOneAndDelete, findOneAndReplace, findOneAndUpdate, insertMany, insertOne, updateMany, updateOne.
The unsupported command ran against the table: demo.users
The unsupported command was: updateMany.
Resend using one of the supported commands.
Example for unsupported by Collection
{
"errors": [
{
"message": "The command is not supported by Collections in the API. \n\nWhile many commands operate on both Tables and Collections, some commands can only be run against Tables or Collections. \n\nThe commands supported by collections are: countDocuments, deleteMany, deleteOne, estimatedDocumentCount, find, findOne, findOneAndDelete, findOneAndReplace, findOneAndUpdate, insertMany, insertOne, updateMany, updateOne.\nThe commands supported by tables are: alterTable, createIndex, createVectorIndex, deleteMany, deleteOne, find, findOne, insertMany, insertOne, listIndexes, updateOne.\n\n\nThe unsupported command ran against the collection: demo.users2\nThe unsupported command was: listIndexes.\n\nResend using one of the supported commands. ",
"scope": "",
"errorCode": "UNSUPPORTED_COLLECTION_COMMAND",
"id": "fece46cb-cfe5-43a1-8bdb-23666d8fd0fe",
"family": "REQUEST",
"title": "Commands is not supported by Collections"
}
]
}
message text - not deliberate that the "commands supported by" lists collections first this time
The command is not supported by Collections in the API.
While many commands operate on both Tables and Collections, some commands can only be run against Tables or Collections.
The commands supported by collections are: countDocuments, deleteMany, deleteOne, estimatedDocumentCount, find, findOne, findOneAndDelete, findOneAndReplace, findOneAndUpdate, insertMany, insertOne, updateMany, updateOne.
The commands supported by tables are: alterTable, createIndex, createVectorIndex, deleteMany, deleteOne, find, findOne, insertMany, insertOne, listIndexes, updateOne.
The unsupported command ran against the collection: demo.users2
The unsupported command was: listIndexes.
Resend using one of the supported commands.
Send this to a table
Get this back
This is handled in the
CommandResolver
interface with defaults so easy to change all in one placebonus points if the error is specific for tables or collections and can list all the commands that are supported for each by iterating an enum or such