DocumentClient.CreateUserDefinedFunctionAsync Method

Definition

Overloads

CreateUserDefinedFunctionAsync(String, UserDefinedFunction, RequestOptions)

Creates a user defined function as an asychronous operation in the Azure DocumentDB database service.

CreateUserDefinedFunctionAsync(Uri, UserDefinedFunction, RequestOptions)

Creates a user defined function as an asychronous operation in the Azure DocumentDB database service.

CreateUserDefinedFunctionAsync(String, UserDefinedFunction, RequestOptions)

Creates a user defined function as an asychronous operation in the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.UserDefinedFunction>> CreateUserDefinedFunctionAsync (string collectionLink, Microsoft.Azure.Documents.UserDefinedFunction function, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
collectionLink
String

The link of the DocumentCollection to create the user defined function in. E.g. dbs/db_rid/colls/col_rid/

function
UserDefinedFunction

The UserDefinedFunction object to create.

options
RequestOptions

(Optional) Any RequestOptionsfor this request.

Returns

A task object representing the service response for the asynchronous operation.

Exceptions

If either collectionLink or function is not set.

Represents a consolidation of failures that occured during async processing. Look within InnerExceptions to find the actual exception(s)

This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:

StatusCodeReason for exception
400BadRequest - This means something was wrong with the request supplied. It is likely that an Id was not supplied for the new user defined function or that the Body was malformed.
403Forbidden - You have reached your quota of user defined functions for the collection supplied. Contact support to have this quota increased.
409Conflict - This means a UserDefinedFunction with an id matching the id you supplied already existed.
413RequestEntityTooLarge - This means the body of the UserDefinedFunction you tried to create was too large.

CreateUserDefinedFunctionAsync(Uri, UserDefinedFunction, RequestOptions)

Creates a user defined function as an asychronous operation in the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.UserDefinedFunction>> CreateUserDefinedFunctionAsync (Uri documentCollectionUri, Microsoft.Azure.Documents.UserDefinedFunction function, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
documentCollectionUri
Uri

the URI of the document collection to create the user defined function in.

function
UserDefinedFunction

the Microsoft.Azure.Documents.UserDefinedFunction object.

options
RequestOptions

The request options for the request.

Returns

The task object representing the service response for the asynchronous operation.