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()}

Here

  • 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.

+3


source to share


1 answer


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:

screenshot of mongo query execution in browser

It is also possible to open a mongo shell through a browser, where you can run requests, in a more traditional mongo format:



mongo shell startup menu

mongo shell

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()

.

+2


source







All Articles