This is the ThingsDB documentation for version v0, click here for the latest version!

new_collection

Create a new collection.

This function generates an event.

Function

new_collection(name)

Arguments

Argument Type Description
name str (required) Name of the new collection.

The user who has created the collection will automatically receive full access rights to the new collection. Use grant to give other users access to the collection.

Return value

Returns the new collection id if successful. A lookup_err() is raised if the collection already exists.

Example

This code will create a collection “awesome_things”:

// Creates a new collection
new_collection('awesome_things');

Example return value in JSON format (the new collection id)

31415