How to get name of collections from Cosmos DB using Mongo API
- I am trying to execute Mongo API to perform CRUD operation on Azure Cosmos-DB.
- I am running a query in Azure Data explorer.
- This is the request I am doing
{db.getCollectionNames()}
- I faced
{"code":500,"body":"{\"message\":\"There was an error processing your request. Please try again in a few moments.\",\"httpStatusCode\":\"InternalServerError\",\"xMsServerRequestId\":null,\"stackTrace\":null}"}
Can you suggest changes if I am doing something wrong here.
source to share
the scope is Mongo Query
not the same as the original MongoDB wrapper. That is, the only thing you can do in the query box is to execute the queries find()
and you only specify the filtering (between {}
). For example:
It is also possible to open a mongo shell through a browser, where you can run requests, in a more traditional mongo format:
With a browser based wrapper, you can also perform updates (for example db.families.update()
) and removes ( db.families.remove()
). But it doesn't support commands like db.getCollectionNames()
.
source to share