atlas_sdk icon indicating copy to clipboard operation
atlas_sdk copied to clipboard

missing Collection `createIndex`?

Open GCSBOSS opened this issue 2 years ago • 4 comments

Is there any possibility top add the createIndex command for collection?

GCSBOSS avatar Jul 05 '23 01:07 GCSBOSS

@GCSBOSS Hey, thanks for reaching out

Do have any idea of how we can implement it? is there any api?

erfanium avatar Jul 05 '23 05:07 erfanium

I haven't tested it myself, but you should be able to add support for the createIndexes operation in the Collection class by implementing it as follows:

async createIndexes(indexes: Document[]): Promise<Document[]> {
  return this.callApi("createIndexes", { indexes });
}

juratori avatar Jul 27 '23 21:07 juratori

@juratori Can you send me the docs for createIndexes api route? I can't find anything related here https://www.mongodb.com/docs/atlas/api/data-api-resources/

It may works, but it's not documented anywhere

erfanium avatar Jul 27 '23 21:07 erfanium

@erfanium you are right! createIndexes doesn't seem to be a built-in route within the 'Atlas Data API'. Instead, I found that it is documented in the 'MongoDB Manual' and is considered a part of the 'MongoDB Atlas Administration API'

It appeared to me that the createIndexes operation is available for use, but it may not be as straightforward as I initially assumed. Implementing it could involve additional steps, such as dropping and listing indexes, and so on.

juratori avatar Jul 28 '23 01:07 juratori