Skip to content
Advertisement

How to write a JavaScript stored procedure in Azure Cosmo DB to return data from SQL API

I’m trying to create a Cosmo DB stored procedure to return the results of a relatively simple SQL statement. If it were purely SQL I would be fine but since I know nothing about JavaScript I’m struggling mightily. Any help would be very much appreciated. Here is the SQL query:

Advertisement

Answer

You can try something like this:

By the way, when you invoke stored procedure, you need to pass partition key value. And you can only get the data from this partition. You can refer to this doc and this.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement