Search code examples
user-defined-functionsazure-cosmosdbudf

Access data in a UDF (User Defined Function) in DocumentDB


Is there a way, to read and process data (e.g. lookup) in a UDF?

I've seen only samples for StoredProcedures. In a UDF, I get an error with the getContext() function.


Solution

  • No. You can only operate on what is passed in. If you can embed the lookup in the UDF code that is a possibility. If you need to get the lookup data from the collection, then a stored procedure is your best option.