Contents
API Docs
bq_add_constraints
- params:
i_coll text, i_jdoc json
- returns:
boolean
- language:
plpgsql
```markdown Add a set of constraints to the collection. The supplied json document should be in the form {field: constraint_spec}, for example: {"age": {"$required": 1, "$notnull": 1, "$type": "number"}} Valid constraints are: $required, $notnull and $type. - {$required: 1} : the field must be present in all documents - {$notnull: 1} : if the field is present, its value must not be null - {$type: '
```
bq_remove_constraints
- params:
i_coll text, i_jdoc json
- returns:
boolean
- language:
plpgsql
```markdown Remove constraints from collection. The supplied json document should match the spec for existing constraints. Returns True if any of the constraints were removed, False otherwise.
```
bq_list_constraints
- params:
i_coll text
- returns:
setof text
- language:
plpgsql
```markdown Get a list of text descriptions of constraints on this collection.
```
bq_create_collection
- params:
i_coll text
- returns:
BOOLEAN
- language:
plpgsql
```markdown Create a collection with the specified name
```
bq_list_collections
- params:
None
- returns:
table(collection_name text)
- language:
plpgsql
```markdown Get a list of existing collections. This checks information_schema for tables matching the expected structure.
```
bq_delete_collection
- params:
i_coll text
- returns:
BOOLEAN
- language:
plpgsql
```markdown Delete/drop a collection. At the moment, this just drops whatever table matches the collection name.
```
bq_find_one
- params:
i_coll text, i_json_query json
- returns:
table(bq_jdoc json)
- language:
plpgsql
```markdown find one
```
bq_find_one_by_id
- params:
i_coll text, i_id text
- returns:
table(bq_jdoc json)
- language:
plpgsql
```markdown
```
bq_find
- params:
i_coll text, i_json_query json
- returns:
table(bq_jdoc json)
- language:
plpgsql
```markdown find many documents
```
bq_count
- params:
i_coll text, i_doc json
- returns:
integer
- language:
plpgsql
```markdown count documents in collection
```
bq_insert
- params:
i_coll text, i_jdoc json
- returns:
text
- language:
plpgsql
```markdown insert document
```
bq_remove
- params:
i_coll text, i_jdoc json
- returns:
setof integer
- language:
plpgsql
```markdown remove documents
```
bq_remove_one
- params:
i_coll text, i_jdoc json
- returns:
setof integer
- language:
plpgsql
```markdown remove one document
```
bq_remove_one_by_id
- params:
i_coll text, i_id text
- returns:
setof integer
- language:
plpgsql
```markdown remove one document
```
bq_save
- params:
i_coll text, i_jdoc json
- returns:
text
- language:
plpgsql
```markdown save document
```
bq_generate_id
- params:
None
- returns:
char(24)
- language:
plpgsql
```markdown Generate a random string ID. Used by the document write functions to populate the '_id' field if it is missing.
```
bq_collection_exists
- params:
None
- returns:
boolean
- language:
plpgsql
```markdown Check if a collection exists. Currently does a simple check for a table with the specified name.
```