create_collection

The function create_collection(schema, collection_name) creates a new collection, according to the provided schema configuration.

input

  • schema – Specifies the path to the configuration file (for example, \schema.json) that you created locally on your machine, as described in Creating a Database Schema Configuration File.

  • collection_name – Specifies the name of the collection to be created in the Hyperspace database. You can specify any name as long as it is unique to your Hyperspace Collection.

Example –

hyperspace_client.create_collection('schema.json', 'collection_name')

Response

The following response should be received –

{'status': 'OK', 'code': 200, 'message': 'Collection was successfully created'}

Collections are a fundamental concept in databases that may organize data as Collections of documents. Collections don't enforce a fixed schema or predefined structure, allowing each document within a Collection to have its own unique set of fields and data. Serving as containers for related documents and records, Collections facilitate logical grouping, making it simpler to organize, manage, and efficiently query, index, and retrieve related data.

Last updated

#108: Max's Nov 6 changes

Change request updated