new_collection

Create a new collection.

After creating a new collection, you might want to configure a different time-zone and/or deep value. The initial deep value and time zone are inherited from the @thingsdb scope. See set_time_zone() and set_default_deep().

This function generates a change.

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 name 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');

Teturn value in JSON format (the new collection name)

"awesome_things"