Creating a Collection
The Hyperspace database stores data within Collections, which are distinct segments within the database.
Hyperspace collections act like data containers, housing a large amount of data to be stored together and then accessed.
To enable the usage of the commands described below, you must first create a local Hyperspace instance to ensure the availability of necessary resources and functionalities.
Copy the following code snippet to create a collection –
Where –
'schema.json' – 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.
Response
The following response should be received –
{'status': 'OK', 'code': 200, 'message': 'Collection was successfully created'}
Alternatively, you can also define the config schema as a python dictionary .
Example -
Collections (sometimes referred to as "indexes") are a fundamental concept in databases that may organize data as Collections of documents. Collection's documents have a general predefined structure, but each document within a Collection can have its own unique set of fields and data out of the schema. 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