@gdnsl/plugin-db
v0.0.55
Published
gdnsl plugin for database commands
Downloads
22
Maintainers
Readme
@gdnsl/plugin-db
gdnsl plugin for database commands
Usage
$ npm install -g @gdnsl/plugin-db
$ @gdnsl/plugin-db COMMAND
running command...
$ @gdnsl/plugin-db (--version)
@gdnsl/plugin-db/0.0.55 darwin-x64 node-v14.20.0
$ @gdnsl/plugin-db --help [COMMAND]
USAGE
$ @gdnsl/plugin-db COMMAND
...
Commands
@gdnsl/plugin-db collection create NAME
@gdnsl/plugin-db collection delete NAME
@gdnsl/plugin-db collection describe NAME
@gdnsl/plugin-db collection list
@gdnsl/plugin-db collection update NAME
@gdnsl/plugin-db document create
@gdnsl/plugin-db document delete KEYS
@gdnsl/plugin-db document describe KEY
@gdnsl/plugin-db document update
@gdnsl/plugin-db export
@gdnsl/plugin-db fabric create NAME
@gdnsl/plugin-db fabric delete NAME
@gdnsl/plugin-db fabric describe FABRIC
@gdnsl/plugin-db fabric list
@gdnsl/plugin-db fabric update FABRIC
@gdnsl/plugin-db graph create NAME
@gdnsl/plugin-db graph delete NAME
@gdnsl/plugin-db graph describe NAME
@gdnsl/plugin-db graph edge create NAME
@gdnsl/plugin-db graph edge delete NAME
@gdnsl/plugin-db graph edge describe NAME
@gdnsl/plugin-db graph edge list
@gdnsl/plugin-db graph edge replace NAME
@gdnsl/plugin-db graph edge update NAME
@gdnsl/plugin-db graph list
@gdnsl/plugin-db graph update GRAPHNAME
@gdnsl/plugin-db graph vertex create NAME
@gdnsl/plugin-db graph vertex delete NAME
@gdnsl/plugin-db graph vertex describe NAME
@gdnsl/plugin-db graph vertex replace NAME
@gdnsl/plugin-db graph vertex update NAME
@gdnsl/plugin-db help [COMMAND]
@gdnsl/plugin-db import COLLECTION
@gdnsl/plugin-db index create NAME
@gdnsl/plugin-db index delete NAME INDEX-NAME
@gdnsl/plugin-db index describe NAME INDEX-NAME
@gdnsl/plugin-db index list NAME
@gdnsl/plugin-db kv create NAME
@gdnsl/plugin-db kv delete NAME
@gdnsl/plugin-db kv get NAME
@gdnsl/plugin-db kv list
@gdnsl/plugin-db kv set NAME
@gdnsl/plugin-db kv update NAME
@gdnsl/plugin-db query [QUERY]
@gdnsl/plugin-db query-worker create [QUERYWORKERNAME]
@gdnsl/plugin-db query-worker delete QUERYWORKERNAME
@gdnsl/plugin-db query-worker describe QUERYWORKERNAME
@gdnsl/plugin-db query-worker list
@gdnsl/plugin-db query-worker next CURSORID
@gdnsl/plugin-db query-worker run [QUERYWORKERNAME]
@gdnsl/plugin-db query-worker update [QUERYWORKERNAME]
@gdnsl/plugin-db query delete CURSOR
@gdnsl/plugin-db query next CURSOR
@gdnsl/plugin-db search SEARCHSTRING
@gdnsl/plugin-db search analyzer [ANALYZERNAME]
@gdnsl/plugin-db view create VIEWNAME
@gdnsl/plugin-db view delete VIEWNAME
@gdnsl/plugin-db view describe VIEWNAME
@gdnsl/plugin-db view list
@gdnsl/plugin-db view rename VIEWNAME NEWNAME
@gdnsl/plugin-db view update VIEWNAME
@gdnsl/plugin-db collection create NAME
Create a document or edge collection.
USAGE
$ @gdnsl/plugin-db collection create [NAME] [-h] [-c <value>] [--fabric <value>] [--type doc|edge] [--stream]
[--local] [--userkeys --keygen traditional|autoincrement|uuid|padded] [--keyincrement <value> ] [--keyoffset <value>
] [--system]
FLAGS
-c, --config=<value>
gdnsl config file (default is ./gdnsl.yaml).
-h, --help
Help to create document or edge collection.
--fabric=<value>
Name of the fabric. Default will be "_system".
--keygen=<option>
The keygenerator to use by GDN. Values - traditional, autoincrement, uuid and padded. traditional - This key
generator generates numerical keys in ascending order. autoincrement- This key generator generates numerical keys in
ascending order, the initial offset and the spacing can be configured. uuid - This key generator generates
universally unique 128 bit keys, which are stored in hexadecimal human-readable format. The keys are not
lexicographically sorted. padded - This key generator generates keys of a fixed length (16 bytes) in ascending
lexicographical sort order.
<options: traditional|autoincrement|uuid|padded>
--keyincrement=<value>
Increment value for autoincrement key generator. Not used for other key generator types.
--keyoffset=<value>
Initial offset value for autoincrement key generator. Not used for other key generator types.
--local
Specifies whether it is a local collection.
--stream
Enable stream on the collection. Default is false.
--system
Specifies whether it is a system collection. Only mm admins can create system collections.
--type=<option>
[default: doc] Specifies type of the collection. Values - "doc" or "edge". Default - "doc"
<options: doc|edge>
--userkeys
Allow users to specify their own keys.
DESCRIPTION
Create a document or edge collection.
EXAMPLES
# Create a global cities document collection.
gdnsl collection create cities --type doc
# Create a global cities edge collection.
gdnsl collection create cities --type edge
# Create a global cities document collection and enable collection stream.
gdnsl collection create cities --type doc --stream
# Create a local cities document collection and enable collection stream.
gdnsl collection create cities --type doc --stream --local
# Create a global cities document collection with custom key generator.
gdnsl collection create cities --type doc --keygen traditional --userkeys
@gdnsl/plugin-db collection delete NAME
Delete a document or edge collection.
USAGE
$ @gdnsl/plugin-db collection delete [NAME] [-h] [-c <value>] [--fabric <value>] [--truncate] [--system]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete a document or edge collection.
--fabric=<value> Name of the fabric. Default will be "_system"
--system Specifies whether it is a system collection. Only mm admins can create system collections.
--truncate Delete all entries from KV collection.
DESCRIPTION
Delete a document or edge collection.
EXAMPLES
# Delete a cities document collection.
gdnsl collection delete cities
# Delete a cities edge collection.
gdnsl collection delete cities
# Delete a cities edge collection which is a system collection.
gdnsl collection delete _cities --system
# Remove all documents from cities collection but leave the indexes intact.
gdnsl collection delete cities --truncate
@gdnsl/plugin-db collection describe NAME
Get details of a collection.
USAGE
$ @gdnsl/plugin-db collection describe [NAME] [-h] [-c <value>] [--fabric <value>] [--count]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to get details of a collection.
--count To return number of documents in the collection.
--fabric=<value> Name of the fabric. Default will be "_system".
DESCRIPTION
Get details of a collection.
EXAMPLES
# Get details of cities collection.
gdnsl collection describe cities
# Count documents in cities collection.
gdnsl collection describe cities --count
@gdnsl/plugin-db collection list
List collections.
USAGE
$ @gdnsl/plugin-db collection list [-h] [-c <value>] [--fabric <value>] [--system] [-o json]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to list collections.
-o, --output=(json) Output format. Only json is allowed.
--fabric=<value> Name of the fabric. Default will be "_system".
--system Specifies whether it is a system collection. Only mm admins can create system collections.
DESCRIPTION
List collections.
EXAMPLES
# List all collections except system collections.
gdnsl collection list
@gdnsl/plugin-db collection update NAME
Enable stream on collection.
USAGE
$ @gdnsl/plugin-db collection update [NAME] [-h] [-c <value>] [--fabric <value>] [--stream] [--wait-for-sync]
ARGUMENTS
NAME Name of the collection
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to enable stream on collection.
--fabric=<value> Name of the fabric. Default will be "_system".
--[no-]stream Enable / Disable collection stream.
--[no-]wait-for-sync Creating or changing a document will wait until the data has been synchronized to disk.
DESCRIPTION
Enable stream on collection.
EXAMPLES
# Enable stream on collection cities.
gdnsl collection update cities --stream
# Disable stream on collection cities.
gdnsl collection update cities --no-stream
# Enable waitForSync on collection cities.
gdnsl collection update cities --wait-for-sync
# Disable waitForSync on collection cities.
gdnsl collection update cities --no-wait-for-sync
# Enable stream and waitForSync on collection cities.
gdnsl collection update cities --stream --wait-for-sync
# Disable stream and waitForSync on collection cities.
gdnsl collection update cities --no-stream --no-wait-for-sync
@gdnsl/plugin-db document create
Create a document.
USAGE
$ @gdnsl/plugin-db document create --collection <value> --json <value> [-h] [-c <value>] [--fabric <value>]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to create a document.
--collection=<value> (required) The name of the collection.
--fabric=<value> Name of the fabric. Default will be "_system".
--json=<value>... (required) A json document to insert.
DESCRIPTION
Create a document.
EXAMPLES
# Create a document in cities collection.
gdnsl document create --json '{"name": "Julia"}' --json '{"name": "John"}' --collection "cities"
@gdnsl/plugin-db document delete KEYS
Delete a document.
USAGE
$ @gdnsl/plugin-db document delete [KEYS] --collection <value> [-h] [-c <value>] [--fabric <value>]
ARGUMENTS
KEYS The key of the document.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete a document.
--collection=<value> (required) The name of the collection.
--fabric=<value> Name of the fabric. Default will be "_system".
DESCRIPTION
Delete a document.
EXAMPLES
# Delete a document.
gdnsl document delete 5326955 --collection cities
# Delete all the specified documents.
gdnsl document delete "5327664, 5327665" --collection cities
@gdnsl/plugin-db document describe KEY
Describe a document.
USAGE
$ @gdnsl/plugin-db document describe [KEY] --collection <value> [-h] [-c <value>] [--fabric <value>]
ARGUMENTS
KEY The key of the document.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to describe a document.
--collection=<value> (required) The name of the collection.
--fabric=<value> Name of the fabric. Default will be "_system".
DESCRIPTION
Describe a document.
EXAMPLES
# Describe a document.
gdnsl document describe 5326955 --fabric _system --collection col1
@gdnsl/plugin-db document update
Update a document.
USAGE
$ @gdnsl/plugin-db document update --collection <value> --json <value> [-h] [-c <value>] [--fabric <value>]
[--replace]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to update a document.
--collection=<value> (required) The name of the collection.
--fabric=<value> Name of the fabric. Default will be "_system".
--json=<value>... (required) The JSON document to update.
--replace Update the existing data.
DESCRIPTION
Update a document.
EXAMPLES
# Update a document.
gdnsl document update --json '{"_key":"5685501", "name": "John"}' --collection cities
# Update multiple documents.
gdnsl document update --json '{"_key":"5685501", "name": "John"}' --json '{"_key":"5377789", "name": "Julia"}' --collection cities
# Replace a document.
gdnsl document update --replace --json '{"_key":"5685501", "name": "John"}' --collection cities
# Replace multiple documents.
gdnsl document update --replace --json '{"_key":"5685501", "name": "John"}' --json '{"_key":"5377789", "name": "Julia"}' --collection cities
@gdnsl/plugin-db export
Export data.
USAGE
$ @gdnsl/plugin-db export [-h] [-c <value>] [--fabric <value>] [--param <value> [--query <value> |
--collection <value> | --offset <value> | --limit <value> | --order asc|desc]] [--csv | --file <value>]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help for export command.
--collection=<value> Collection name to export data from.
--csv To export in CSV format. Default is JSON.
--fabric=<value> Name of the fabric. Default will be "_system".
--file=<value> path to JSON or CSV file. File format is inferred from the file extension. Note: Only json and
csv extensions are allowed.
--limit=<value> This option can be used to simulate paging. Limit the result. Max: 1000
--offset=<value> This option can be used to simulate paging. Default: 0.
--order=<option> Order the results asc or desc. Default: asc.
<options: asc|desc>
--param=<value>... Param to be given to the query. Can be given multiple times.
--query=<value> Query string to execute and export data
DESCRIPTION
Export data.
EXAMPLES
# Export data returned by the query.
gdnsl export --query "FOR doc IN addresses RETURN doc"
# Export data returned by the query with based on the given filter.
gdnsl export --query "FOR doc IN addresses FILTER doc.country == @country RETURN doc" --param "country=USA"
# Export data returned by the query in CSV format.
gdnsl export --query "FOR doc IN addresses RETURN doc" --csv
# Export data returned by the query in JSON format to a file.
gdnsl export --query "FOR doc IN addresses RETURN doc" --file test.json
# Export data from "addresses" collection.
gdnsl export --collection addresses
# Export data from "addresses" collection with offset as 10.
gdnsl export --collection addresses --offset 10
# Export data from "addresses" collection with limit as 10.
gdnsl export --collection addresses --limit 10
# Export data from "addresses" collection in descending order.
gdnsl export --collection addresses --order desc
# Export data from "addresses" collection in CSV format.
gdnsl export --collection addresses --csv
# Export data from "addresses" collection in CSV format. File format is inferred from the file name.
gdnsl export --collection addresses --file test.csv
See code: dist/commands/export.ts
@gdnsl/plugin-db fabric create NAME
Create a new fabric.
USAGE
$ @gdnsl/plugin-db fabric create [NAME] --datacenter <value> [-h] [-c <value>] [--spot-datacenter <value>]
[--user <value>] [--metadata <value>]
ARGUMENTS
NAME Fabric name
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to create a fabric.
--datacenter=<value>... (required) Name of a Edge Location (datacenter). ie, Edge Location URL prefixes up to
the first "." character.
--metadata=<value>... An optional JSON object with user defined key-value pairs.
--spot-datacenter=<value>... The Edge Location (Datacenter) where on-spot operations for the given fabric will be
performed.
--user=<value>... Username that will have admin access to the new fabric.
DESCRIPTION
Create a new fabric.
EXAMPLES
# Create demo fabric in the prashant-ap-west data-center.
gdnsl fabric create demo --datacenter "prashant-ap-west" --datacenter "prashant-eu-central"
# Create demo fabric in the data-center with metadata.
gdnsl fabric create demo --datacenter "prashant-ap-west" --datacenter "prashant-eu-central" --metadata "key=value"
# Create demo fabric in the data-center with spot-datacenter.
gdnsl fabric create demo --datacenter "prashant-ap-west" --datacenter "prashant-eu-central" --spot-datacenter prashant-us-east
# Create demo fabric in the data-center with a user.
gdnsl fabric create demo --datacenter "prashant-ap-west" --datacenter "prashant-eu-central" --user admin
# Create demo fabric with 2 metadata objects.
gdnsl fabric create demo --datacenter "prashant-ap-west" --datacenter "prashant-eu-central" --metadata "key1=value1" --metadata "key2=value2"
@gdnsl/plugin-db fabric delete NAME
Delete a fabric.
USAGE
$ @gdnsl/plugin-db fabric delete [NAME] [-h] [-c <value>]
ARGUMENTS
NAME Fabric name.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete a fabric.
DESCRIPTION
Delete a fabric.
EXAMPLES
# Delete demo fabric.
gdnsl fabric delete demo
@gdnsl/plugin-db fabric describe FABRIC
Get details of a fabric.
USAGE
$ @gdnsl/plugin-db fabric describe [FABRIC] [-h] [-c <value>]
ARGUMENTS
FABRIC Fabric name.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to get details of a fabric.
DESCRIPTION
Get details of a fabric.
EXAMPLES
# Describe demo fabric
gdnsl fabric describe demo
@gdnsl/plugin-db fabric list
Retrieve the list of all existing fabrics.
USAGE
$ @gdnsl/plugin-db fabric list [-h] [-c <value>] [--all] [-o json]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to list all fabrics.
-o, --output=(json) Output format. Only json is allowed.
--all List of all fabrics.
DESCRIPTION
Retrieve the list of all existing fabrics.
EXAMPLES
# List fabrics from the server and returns an array of their names.
gdnsl fabric list
# List all fabrics accessible to the active user from the server and returns an array of their names.
gdnsl fabric list --all
@gdnsl/plugin-db fabric update FABRIC
Update a fabric.
USAGE
$ @gdnsl/plugin-db fabric update [FABRIC] [-h] [-c <value>] [--metadata <value>]
ARGUMENTS
FABRIC Fabric name.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to update a fabric.
--metadata=<value>... An optional JSON object with user defined key-value pairs.
DESCRIPTION
Update a fabric.
EXAMPLES
# Update demo fabric metadata with 2 metadata objects.
gdnsl fabric update demo --metadata "key1=test1" --metadata "key2=test2"
@gdnsl/plugin-db graph create NAME
Create a graph.
USAGE
$ @gdnsl/plugin-db graph create [NAME] [-h] [-c <value>] [--fabric <value>] [--edge-definition <value>]
[--option <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value>
gdnsl config file (default is ./gdnsl.yaml).
-h, --help
Help to create a graph.
--edge-definition=<value>...
Specify the edge definition of the graph. This edge definition has to contain a collection and an array of each from
and to vertex collections. An edge definition can only be added if this definition is either not used in any other
graph, or it is used with exactly the same definition. It is not possible to store a definition "e" from "v1" to
"v2" in the one graph, and "e" from "v2" to "v1" in the other graph. Can be given multiple times.
--fabric=<value>
Name of the fabric. Default will be "_system".
--option=<value>
Specify any additional options to be given. Can be given multiple times.
DESCRIPTION
Create a graph.
EXAMPLES
# Create a graph "social".
gdnsl graph create social
# The edge-definition format is "EDGE_COLLECTION:FROM_VERTICES:TO_VERTICES". Create a graph "social" with edge collection "relation", "from" vertex as "female" & "male" and "to" vertex as "female" & "male".
gdnsl graph create social --edge-definition "relation:female,male:female,male"
# The edge-definition format is "EDGE_COLLECTION:FROM_VERTICES:TO_VERTICES". Create a graph "social" with edge collection "relation", "from" vertex as "female" & "male" and "to" vertex as "female" & "male" with additional options specified.
gdnsl graph create social --edge-definition "relation:female,male:female,male" --option "key=value"
@gdnsl/plugin-db graph delete NAME
Delete a graph.
USAGE
$ @gdnsl/plugin-db graph delete [NAME] [-h] [-c <value>] [--fabric <value>] [--drop-collections]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete a graph
--drop-collections Drop the collection as well. Collection will only be dropped if it is not used in other graphs.
Default is false.
--fabric=<value> Name of the fabric. Default will be "_system"
DESCRIPTION
Delete a graph.
EXAMPLES
# Drop the graph "social".
gdnsl graph delete social
# Drop the graph "social" and any collections if they are not used in other graphs.
gdnsl graph delete social --drop-collections
@gdnsl/plugin-db graph describe NAME
Describe a graph.
USAGE
$ @gdnsl/plugin-db graph describe [NAME] [-h] [-c <value>] [--fabric <value>] [--edge-definitions] [--vertex]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to describe a graph
--edge-definitions Get all the edge definitions of a graph.
--fabric=<value> Name of the fabric. Default will be "_system"
--vertex Get all the vertex collections of a graph.
DESCRIPTION
Describe a graph.
EXAMPLES
# Describe the graph "social".
gdnsl graph describe social
# Describe all edge definitions of the graph "social".
gdnsl graph describe social --edge-definitions
# Describe all vertex collections of the graph "social".
gdnsl graph describe social --vertex
@gdnsl/plugin-db graph edge create NAME
Create an edge.
USAGE
$ @gdnsl/plugin-db graph edge create [NAME] --from <value> --to <value> --collection <value> [-h] [-c <value>]
[--fabric <value>] [--return-new]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to create an edge
--collection=<value> (required) The name of the edge collection the edge belongs to.
--fabric=<value> Name of the fabric. Default will be "_system"
--from=<value> (required) The source vertex of this edge. Has to be valid within the used edge definition.
--return-new Define if the response should contain the complete new version of the document.
--to=<value> (required) The target vertex of this edge. Has to be valid within the used edge definition.
DESCRIPTION
Create an edge.
EXAMPLES
# Create an edge in the "social" graph in "relation" edge-collection from "male/John" to "female/Doe".
gdnsl graph edge create social --collection relation --from "male/John" --to "female/Doe"
# Create an edge in the "social" graph in "relation" edge-collection from "male/John" to "female/Doe" and return the new version of the document.
gdnsl graph edge create social --collection relation --from "male/John" --to "female/Doe" --return-new
@gdnsl/plugin-db graph edge delete NAME
Remove an edge from the collection.
USAGE
$ @gdnsl/plugin-db graph edge delete [NAME] --collection <value> --edge <value> [-h] [-c <value>] [--fabric <value>]
[--return-old] [--if-match <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete an edge.
--collection=<value> (required) The name of the edge collection the edge belongs to.
--edge=<value> (required) The _key attribute of the edge.
--fabric=<value> Name of the fabric. Default will be "_system"
--if-match=<value> If the "If-Match" header is given, then it must contain exactly one Etag. The document is
updated, if it has the same revision as the given Etag. Otherwise a HTTP 412 is returned
--return-old Define if a presentation of the deleted document should be returned within the response object.
Default is false
DESCRIPTION
Remove an edge from the collection.
EXAMPLES
# delete an edge in the "social" graph in "relation" edge-collection having edge _id attribute as "MwPFf8dgSH-bxeNxuPh6bw".
gdnsl graph edge delete social --collection relation --edge "MwPFf8dgSH-bxeNxuPh6bw"
# delete an edge in the "social" graph in "relation" edge-collection _id attribute as "MwPFf8dgSH-bxeNxuPh6bw" and return the new version of the document.
gdnsl graph edge delete social --collection relation --edge "MwPFf8dgSH-bxeNxuPh6bw"
@gdnsl/plugin-db graph edge describe NAME
Describe an edge.
USAGE
$ @gdnsl/plugin-db graph edge describe [NAME] --collection <value> --edge <value> [-h] [-c <value>] [--fabric <value>]
[--rev <value>] [--if-match <value>] [--if-none-match <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to describe a graph
--collection=<value> (required) he name of the vertex collection the vertex belongs to.
--edge=<value> (required) The _key attribute of the edge.
--fabric=<value> Name of the fabric. Default will be "_system"
--if-match=<value> If the "If-Match" header is given, then it must contain exactly one Etag. The document is
returned, if it has the same revision as the given Etag. Otherwise a HTTP 412 is returned. As
an alternative you can supply the Etag in an query parameter rev.
--if-none-match=<value> If the "If-None-Match" header is given, then it must contain exactly one Etag. The document
is returned, only if it has a different revision as the given Etag. Otherwise a HTTP 304 is
returned.
--rev=<value> Must contain a revision. If this is set a document is only returned if it has exactly this
revision. Also see if-match header as an alternative to this. Default is false.
DESCRIPTION
Describe an edge.
EXAMPLES
# Describe the edge with the _key as "1w44RO8kQMG3kB0feiua1g" in the collection "relation".
gdnsl graph edge describe social --collection relation --edge 1w44RO8kQMG3kB0feiua1g
@gdnsl/plugin-db graph edge list
List edges starting or ending in the vertex.
USAGE
$ @gdnsl/plugin-db graph edge list --vertex-id <value> --collection <value> [-h] [-c <value>] [--fabric <value>]
[--direction in|out]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to create a graph
--collection=<value> (required) The id of the collection.
--direction=<option> Selects "in" or "out" direction for edges. If not set, any edges are returned.
<options: in|out>
--fabric=<value> Name of the fabric. Default will be "_system"
--vertex-id=<value> (required) The id of the start vertex.
DESCRIPTION
List edges starting or ending in the vertex.
EXAMPLES
# Get the edges from the "relation" collection from any direction in the vertex "female/alice".
gdnsl graph edge list --collection relation --vertex-id "female/alice"
# Get the edges from the "relation" collection from "in" direction in the vertex "female/alice".
gdnsl graph edge list --collection relation --vertex-id "female/alice" --direction "in"
@gdnsl/plugin-db graph edge replace NAME
Replaces the data of an edge in the collection.
USAGE
$ @gdnsl/plugin-db graph edge replace [NAME] --collection <value> --data <value> --edge <value> [-h] [-c <value>]
[--fabric <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to update a graph
--collection=<value> (required) The name of the edge collection the edge belongs to.
--data=<value> (required) json string of the data to be stored
--edge=<value> (required) The _key attribute of the edge.
--fabric=<value> Name of the fabric. Default will be "_system"
DESCRIPTION
Replaces the data of an edge in the collection.
EXAMPLES
# Replace the edge with the _key as "1w44RO8kQMG3kB0feiua1g" in the collection "relation" in the graph "social".
gdnsl graph edge replace social --collection relation --edge 1w44RO8kQMG3kB0feiua1g --data '{"name": "John", "lname": "Doe"}'
@gdnsl/plugin-db graph edge update NAME
Update an edge.
USAGE
$ @gdnsl/plugin-db graph edge update [NAME] --collection <value> --edge <value> --data <value> [-h] [-c <value>]
[--fabric <value>] [--keep-null] [--return-old] [--return-new] [--if-match <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to update an edge
--collection=<value> (required) The name of the edge collection the edge belongs to.
--data=<value> (required) JSON body as string.
--edge=<value> (required) The _key attribute of the edge.
--fabric=<value> Name of the fabric. Default will be "_system"
--if-match=<value> If the "If-Match" header is given, then it must contain exactly one Etag. The document is
updated, if it has the same revision as the given Etag. Otherwise a HTTP 412 is returned
--keep-null Define if values set to null should be stored. By default the key is not removed from the
document. Default is true.
--return-new Define if a presentation of the new document should be returned within the response object.
Default is true.
--return-old Define if a presentation of the deleted document should be returned within the response object.
Default is false.
DESCRIPTION
Update an edge.
EXAMPLES
# Replace the edge with the _key as "1w44RO8kQMG3kB0feiua1g" in the collection "relation" in the graph "social".
gdnsl graph edge update social --collection relation --edge 1w44RO8kQMG3kB0feiua1g --data '{"fname":"John"}'
@gdnsl/plugin-db graph list
List graphs.
USAGE
$ @gdnsl/plugin-db graph list [-h] [-c <value>] [--fabric <value>] [-o json]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to list graphs
-o, --output=(json) Output format. Only json is allowed.
--fabric=<value> Name of the fabric. Default will be "_system"
DESCRIPTION
List graphs.
EXAMPLES
# List all graphs
gdnsl graph list
@gdnsl/plugin-db graph update GRAPHNAME
Update a graph.
USAGE
$ @gdnsl/plugin-db graph update [GRAPHNAME] [-h] [-c <value>] [--fabric <value>] [--stream |
[--add-edge-definition <value> | --add-vertex-collection <value> | --remove-vertex-collection <value> |
--replace-edge-definition <value> | --remove-edge-collection <value>] | | | | | --drop-collection | --collection
<value>] [--wait-for-sync | | | | | | | ]
ARGUMENTS
GRAPHNAME Name of the graph.
FLAGS
-c, --config=<value>
gdnsl config file (default is ./gdnsl.yaml).
-h, --help
Help to update a graph.
--add-edge-definition=<value>...
specify the edge definition of the graph. This edge definition has to contain a collection and an array of each from
and to vertex collections. An edge definition can only be added if this definition is either not used in any other
graph, or it is used with exactly the same definition. It is not possible to store a definition "e" from "v1" to
"v2" in the one graph, and "e" from "v2" to "v1" in the other graph.
--add-vertex-collection=<value>
Adds a vertex collection to the set of orphan collections of the graph. If the collection does not exist, it will be
created.
--collection=<value>
The name of the edge collection the edge belongs to. Should be used with "--replace-edge-definition" flag.
--drop-collection
Drop the collection as well. Collection will only be dropped if it is not used in other graphs. Default value is
false.
--fabric=<value>
Name of the fabric. Default will be "_system".
--remove-edge-collection=<value>
Remove one edge definition from the graph. This will only remove the edge collection, the vertex collections remain
untouched and can still be used in your queries.
--remove-vertex-collection=<value>
The name of the edge collection the edge belongs to. Removes a vertex collection from the graph and optionally
deletes the collection, if it is not used in any other graph. It can only remove vertex collections that are no
longer part of edge definitions, if they are used in edge definitions you are required to modify those first.
--replace-edge-definition=<value>...
Specify the edge definition of the graph. This edge definition has to contain a collection and an array of each from
and to vertex collections. An edge definition can only be added if this definition is either not used in any other
graph, or it is used with exactly the same definition. It is not possible to store a definition "e" from "v1" to
"v2" in the one graph, and "e" from "v2" to "v1" in the other graph.
--[no-]stream
Enable / Disable kv collection stream.
--[no-]wait-for-sync
Creating or changing a document will wait until the data has been synchronized to disk.
DESCRIPTION
Update a graph.
EXAMPLES
# The edge-definition format is "EDGE_COLLECTION:FROM_VERTICES:TO_VERTICES". Add an edge-definition to the graph "social" for the edge collection "relation", set "from" vertex as "female" & "male" and set "to" vertex as "female" & "male"
gdnsl graph update social --add-edge-definition "relation:female,male:female,male"
# Add a vertex collection "age" to the graph "social"'s orphan collections.
gdnsl graph update social --add-vertex-collection "age"
# Remove "age" vertex collection from graph "social".
gdnsl graph update social --remove-vertex-collection "age"
# Remove the edge definitions belonging to the "relation" edge collection.
gdnsl graph update social --remove-edge-collection "relation"
# The edge-definition format is "EDGE_COLLECTION:FROM_VERTICES:TO_VERTICES". Replace an edge-definition of the graph "social" for the edge collection "relation", set "from" vertices as "female" & "male", and set "to" vertices as "female" & "male".
gdnsl graph update social --collection relation --replace-edge-definition "relation:female,male:female,male"
# Replace a vertex collection "age" to the graph "social"'s orphan collections and drop the collection if it is not being used.
gdnsl graph update social --collection relation --replace-edge-definition "relation:female,male:female,male" --drop-collections
# Enable stream on graph collection social.
gdnsl graph update social --stream
# Disable stream on graph collection social.
gdnsl graph update social --no-stream
# Enable waitForSync on graph collection social.
gdnsl graph update social --wait-for-sync
# Disable waitForSync on graph collection social.
gdnsl graph update social --no-wait-for-sync
# Enable stream and waitForSync on graph collection social.
gdnsl graph update social --stream --wait-for-sync
# Disable stream and waitForSync on graph collection social.
gdnsl graph update social --no-stream --no-wait-for-sync
@gdnsl/plugin-db graph vertex create NAME
Create a vertex.
USAGE
$ @gdnsl/plugin-db graph vertex create [NAME] --collection <value> [-h] [-c <value>] [--fabric <value>] [--return-new]
[--data <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to create a vertex.
--collection=<value> (required) The name of the vertex collection the vertex belongs to.
--data=<value> JSON string of the data to be stored.
--fabric=<value> Name of the fabric. Default will be "_system"
--return-new Define if the response should contain the complete new version of the document.
DESCRIPTION
Create a vertex.
EXAMPLES
# Create a vertex in the graph "social" with the vertex collection as "male".
gdnsl graph vertex create social --collection male --data '{"name": "John"}'
@gdnsl/plugin-db graph vertex delete NAME
Delete a vertex.
USAGE
$ @gdnsl/plugin-db graph vertex delete [NAME] --collection <value> --vertex <value> [-h] [-c <value>] [--fabric
<value>] [--return-old] [--if-match <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete a vertex
--collection=<value> (required) The name of the vertex collection the vertex belongs to.
--fabric=<value> Name of the fabric. Default will be "_system"
--if-match=<value> If the "If-Match" header is given, then it must contain exactly one Etag. The document is
updated, if it has the same revision as the given Etag. Otherwise a HTTP 412 is returned.
--return-old Define if a presentation of the deleted document should be returned within the response object.
Default is false.
--vertex=<value> (required) The _key attribute of the vertex.
DESCRIPTION
Delete a vertex.
EXAMPLES
# Delete a vertex in the graph "social" with the vertex collection as "male" having _key as "John".
gdnsl graph vertex delete social --collection male --vertex "John"
# Delete a vertex in the graph "social" with the vertex collection as "male" having _key as "John" and return the old object.
gdnsl graph vertex delete social --collection male --vertex "John" --return-old
@gdnsl/plugin-db graph vertex describe NAME
Describe a vertex.
USAGE
$ @gdnsl/plugin-db graph vertex describe [NAME] --collection <value> --vertex <value> [-h] [-c <value>] [--fabric
<value>] [--rev <value>] [--if-match <value>] [--if-none-match <value>]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to describe a vertex
--collection=<value> (required) The name of the vertex collection the vertex belongs to.
--fabric=<value> Name of the fabric. Default will be "_system"
--if-match=<value> If the "If-Match" header is given, then it must contain exactly one Etag. The document is
returned, if it has the same revision as the given Etag. Otherwise a HTTP 412 is returned. As
an alternative you can supply the Etag in an query parameter rev.
--if-none-match=<value> If the "If-None-Match" header is given, then it must contain exactly one Etag. The document
is returned, only if it has a different revision as the given Etag. Otherwise a HTTP 304 is
returned.
--rev=<value> Must contain a revision. If this is set a document is only returned if it has exactly this
revision. Also see if-match header as an alternative to this.
--vertex=<value> (required) The _key attribute of the vertex.
DESCRIPTION
Describe a vertex.
EXAMPLES
# Describe the vertex with the _key as "bob" in the collection "male".
gdnsl graph vertex describe social --collection male --vertex bob
@gdnsl/plugin-db graph vertex replace NAME
Replace a vertex.
USAGE
$ @gdnsl/plugin-db graph vertex replace [NAME] --collection <value> --vertex <value> --data <value> [-h] [-c <value>]
[--fabric <value>] [--return-new] [--keep-null] [--return-old] [--if-match]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to replace a vertex
--collection=<value> (required) The name of the vertex collection the vertex belongs to.
--data=<value> (required) json string of the data to be stored.
--fabric=<value> Name of the fabric. Default will be "_system"
--if-match If the "If-Match" header is given, then it must contain exactly one Etag. The document is
updated, if it has the same revision as the given Etag. Otherwise a HTTP 412 is returned.
--keep-null Define if values set to null should be stored. By default the key is not removed from the
document. Default is false.
--return-new Define if the response should contain the complete new version of the document. Default is
false.
--return-old Define if a presentation of the deleted document should be returned within the response object.
Default is false.
--vertex=<value> (required) The _key attribute of the vertex.
DESCRIPTION
Replace a vertex.
EXAMPLES
# Replace a vertex having _key "John" in the graph "social" with the vertex collection as "male".
gdnsl graph vertex replace social --collection male --vertex "John" --data '{"name": "John", "lname": "Doe"}'
@gdnsl/plugin-db graph vertex update NAME
Update a vertex.
USAGE
$ @gdnsl/plugin-db graph vertex update [NAME] --collection <value> --vertex <value> --data <value> [-h] [-c <value>]
[--fabric <value>] [--return-new] [--keep-null] [--return-old] [--if-match]
ARGUMENTS
NAME Name of the graph.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to update a vertex
--collection=<value> (required) The name of the edge collection the edge belongs to.
--data=<value> (required) JSON string of the data to be stored.
--fabric=<value> Name of the fabric. Default will be "_system"
--if-match If the "If-Match" header is given, then it must contain exactly one Etag. The document is
updated, if it has the same revision as the given Etag. Otherwise a HTTP 412 is returned.
--keep-null Define if values set to null should be stored. By default the key is not removed from the
document. Default is false.
--return-new Define if the response should contain the complete new version of the document. Default is
false.
--return-old Define if a presentation of the deleted document should be returned within the response object.
Default is false.
--vertex=<value> (required) The _key attribute of the vertex.
DESCRIPTION
Update a vertex.
EXAMPLES
# Update a vertex having _key "John" in the graph "social" with the vertex collection as "male".
gdnsl graph vertex update social --collection male --vertex "John" --data '{"name": "John", "lname": "Doe"}'
@gdnsl/plugin-db help [COMMAND]
Display help for @gdnsl/plugin-db.
USAGE
$ @gdnsl/plugin-db help [COMMAND] [-n]
ARGUMENTS
COMMAND Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for @gdnsl/plugin-db.
See code: @oclif/plugin-help
@gdnsl/plugin-db import COLLECTION
Import collection data.
USAGE
$ @gdnsl/plugin-db import [COLLECTION] [-h] [-c <value>] [--fabric <value>] [--primary-key <value>]
[--replace] [--details] [--batch-size <value> [--file <value> | [--json <value> | --csv <value> | --columns <value>]
| | ]]
ARGUMENTS
COLLECTION Existing collection to import the data to.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help help for import command
--batch-size=<value> Number of docs to be imported in a batch. Cannot be greater than the set tenant limit. Default
will the tenant limit.
--columns=<value> should be a comma separated list of column names.
--csv=<value> should be an array of csv rows. Each row is separated by a newline character.
--details if true extra information for errors and unprocessed documents will be returned in the result.
--fabric=<value> Name of the fabric. Default will be "_system"
--file=<value> path to JSON or CSV file. File format is inferred from the file extension
--json=<value> should be an array of json documents. Each document is interpreted separately.
--primary-key=<value> if specified, this attribure will be used as _key of the new document. It must follow
https://macrometa.dev/documents/naming-conventions/#document-keys . If document already
contains _key then it will be renamed as old_key.
--replace if true existing document having same _key in the colletion, shall be replaced.
DESCRIPTION
Import collection data.
EXAMPLES
# Import documents in the "addresses" collection.
gdnsl import addresses --json "[{\"name\": \"John\"}, {\"lname\": \"Doe\"}]"
# Import documents in the "addresses" collection with primaryKey as "name".
gdnsl import addresses --json "[{\"name\": \"John\"}, {\"lname\": \"Doe\"}]" --primary-key "name"
# Import documents with existing document having same _key in the colletion, shall be replaced.
gdnsl import addresses --json "[{\"name\": \"John\"}, {\"lname\": \"Doe\"}]" --replace
# Import documents with extra information for errors and unprocessed documents returned in the result.
gdnsl import addresses --json "[{\"name\": \"John\"}, {\"lname\": \"Doe\"}]" --details
# Import documents in the "addresses" collection.
gdnsl import addresses --csv "John,Doe
Jane,Doe" --columns "name, lname"
# Import documents in the "addresses" collection with primaryKey as "name".
gdnsl import addresses --csv "John,Doe
Jane,Doe" --columns "name, lname" --primary-key "name"
# Import documents with existing document having same _key in the colletion, shall be replaced.
gdnsl import addresses --csv "John,Doe
Jane,Doe" --columns "name, lname" --replace
# Import documents with extra information for errors and unprocessed documents returned in the result.
gdnsl import addresses --csv "John,Doe
Jane,Doe" --columns "name, lname" --details
# Import documents from a JSON file.
gdnsl import --file "path_to_file/import.json"
# Import documents from a CSV file.
gdnsl import --file "path_to_file/import.csv"
#Import documents from a JSON file with bacth size of 1000.
gdnsl import --file import.json --batch-size=1000
See code: dist/commands/import.ts
@gdnsl/plugin-db index create NAME
Create an index of a collection.
USAGE
$ @gdnsl/plugin-db index create [NAME] --type persistent|ttl|geo --fields <value> [-h] [-c <value>] [--fabric
<value>] [--sparse] [--unique] [--expire-after <value>] [--geo-json]
ARGUMENTS
NAME Collection name
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to create an index
--expire-after=<value> The time (in seconds) after a document's creation after which the documents count as
"expired". Applicable only for "ttl" index.
--fabric=<value> Name of the fabric. Default will be "_system"
--fields=<value> (required) Comma seperated attribute paths (i.e. "f1, f2"). Note: For ttl, exactly one
attribute path is required.
--geo-json If true, creates a geo-spatial index. Applicable only for "geo" index.
--sparse If true, then create a sparse index. Applicable only for "persistent" index.
--type=<option> (required) Type of the index. Must be one of: persistent, ttl, geo
<options: persistent|ttl|geo>
--unique If true, then create a unique index. Applicable only for "persistent" index.
DESCRIPTION
Create an index of a collection.
EXAMPLES
# Create a PERSISTENT index on cities collection.
gdnsl index create cities --type persistent --fields "f1, f2"
# Create a sparse persistent index on cities collection.
gdnsl index create cities --type persistent --fields "f1, f2" --sparse
# Create a unique persistent index on cities collection.
gdnsl index create cities --type persistent --fields "f1, f2" --unique
# Create a sparse and unique persistent index on cities collection.
gdnsl index create cities --type persistent --fields "f1, f2" --unique --sparse
# Create a TTL index on cities collection.
gdnsl index create cities --type ttl --fields "f1, f2"
# Create a TTL index with expirytime on cities collection.
gdnsl index create cities --type ttl --expireAfter --fields "f1, f2"
# Create a GEO index with latitude and longitude fields in cities collection.
gdnsl index create cities --type geo --fields "f1, f2"
# Create a GEO index with longitude and latitude fields in cities collection.
gdnsl index create cities --type geo --geo-json --fields "f1, f2"
@gdnsl/plugin-db index delete NAME INDEX-NAME
Delete an index of a collection.
USAGE
$ @gdnsl/plugin-db index delete [NAME] [INDEX-NAME] [-h] [-c <value>] [--fabric <value>]
ARGUMENTS
NAME Collection name.
INDEX-NAME Index name.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete an index.
--fabric=<value> Name of the fabric. Default will be "_system"
DESCRIPTION
Delete an index of a collection.
EXAMPLES
# Delete index named idx_1719031308384993280 on cities collection.
gdnsl index delete cities idx_1719031308384993280
@gdnsl/plugin-db index describe NAME INDEX-NAME
Get details of an index.
USAGE
$ @gdnsl/plugin-db index describe [NAME] [INDEX-NAME] [-h] [-c <value>] [--fabric <value>]
ARGUMENTS
NAME Collection name.
INDEX-NAME Index name.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to get details of a collection
--fabric=<value> Name of the fabric. Default will be "_system".
DESCRIPTION
Get details of an index.
EXAMPLES
# Get details of index1 index in cities collection.
gdnsl index describe cities index1
@gdnsl/plugin-db index list NAME
List all indexes of a collection.
USAGE
$ @gdnsl/plugin-db index list [NAME] [-h] [-c <value>] [--fabric <value>] [-o json]
ARGUMENTS
NAME Collection name.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to list all indexes of a collection.
-o, --output=(json) Output format. Only json is allowed
--fabric=<value> Name of the fabric. Default will be "_system".
DESCRIPTION
List all indexes of a collection.
EXAMPLES
# List all indexes on cities collection.
gdnsl index list cities
@gdnsl/plugin-db kv create NAME
Create a KV collection.
USAGE
$ @gdnsl/plugin-db kv create [NAME] [-h] [-c <value>] [--fabric <value>] [--ttl] [--stream]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to create KV collection.
--fabric=<value> Name of the fabric. Default will be "_system".
--stream Enable stream on the collection. Default is false.
--ttl Enable TTL on the collection. Default is false.
DESCRIPTION
Create a KV collection.
EXAMPLES
# Create a global KV collection.
gdnsl kv create cities
# Create a global KV collection with ttl.
gdnsl kv create cities --ttl
# Create a global KV collection with stream enabled.
gdnsl kv create cities --stream
# Create a global KV collection with both TTL and Stream enabled.
gdnsl kv create cities --ttl --stream
@gdnsl/plugin-db kv delete NAME
Delete a KV collection.
USAGE
$ @gdnsl/plugin-db kv delete [NAME] [-h] [-c <value>] [--fabric <value>] [--keyarray <value>] [--key <value>]
[--truncate]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to delete a KV collection
--fabric=<value> Name of the fabric. Default will be "_system".
--key=<value> Delete entry for given key from KV collection.
--keyarray=<value> Delete entries for all given keys from KV collection.
--truncate Delete all entries from KV collection.
DESCRIPTION
Delete a KV collection.
EXAMPLES
# Delete cities KV collection.
gdnsl kv delete cities
# Delete key1, key2 entries from cities KV collection.
gdnsl kv delete cities --keyarray "k1, k2"
# Delete key1 from cities KV collection.
gdnsl kv delete cities --key k1
# Delete all entries from cities KV collection.
gdnsl kv delete cities --truncate
@gdnsl/plugin-db kv get NAME
Get keys, values or count from a Key Value collection.
USAGE
$ @gdnsl/plugin-db kv get [NAME] [-h] [--count] [--keys] [--values] [--offset <value>] [--limit <value>]
[--order asc|desc] [--keyarray <value>] [--key <value>] [-c <value>] [--fabric <value>] [-o json]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to get keys, values or count from a Key Value collection.
-o, --output=(json) Output format. Only json is allowed.
--count Number of entries in the KV collection.
--fabric=<value> Name of the fabric. Default will be "_system".
--key=<value> Get value for a given key in the KV collection.
--keyarray=<value> String List of comma separated keys
--keys Get all keys in the KV collection.
--limit=<value> [default: 20] Default value 20. Max 10000
--offset=<value> Default value 0
--order=<option> [default: asc] String "asc" or "desc". Default value asc.
<options: asc|desc>
--values Get all values in the KV collection.
DESCRIPTION
Get keys, values or count from a Key Value collection.
EXAMPLES
# Get number of entries in cities collection
gdnsl kv get cities --count
# Get all keys in cities collection.
gdnsl kv get cities --keys
# Get keys in cities collection.
gdnsl kv get cities --keys --offset 0 --limit 50 --order asc
# Get all values in cities collection.
gdnsl kv get cities --values
# Get keys in cities collection.
gdnsl kv get cities --values --offset 0 --limit 50 --order asc cities --keys
# Get keys in cities collection.
gdnsl kv get cities --values --keyarray "key1, key2, key3"
# Get value for key1 in cities collection.
gdnsl kv get cities --key key1
@gdnsl/plugin-db kv list
List Key Value collections.
USAGE
$ @gdnsl/plugin-db kv list [-h] [-c <value>] [--fabric <value>] [-o json]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to list Key Value collections.
-o, --output=(json) Output format. Only json is allowed.
--fabric=<value> Name of the fabric. Default will be "_system"
DESCRIPTION
List Key Value collections.
EXAMPLES
# List all KV collections.
gdnsl kv list
@gdnsl/plugin-db kv set NAME
Set values or KV pair in a Key Value collection.
USAGE
$ @gdnsl/plugin-db kv set [NAME] [-h] [--ttl <value> [--key <value> --value <value>]] [--kv <value> | | ]
[-c <value>] [--fabric <value>]
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to set values or KV pair in a Key Value collection.
--fabric=<value> Name of the fabric. Default will be "_system"
--key=<value> Key for the kv entry.
--kv=<value>... key value string for the KV collection i.e. "k1:v1:12234324".
--ttl=<value> Unix timestamp, indicating when the value will expire (-1 means no expiration).
--value=<value> Value for the kv entry.
DESCRIPTION
Set values or KV pair in a Key Value collection.
EXAMPLES
# Add k1:v1 entry to cities collection with TTL. (unix timestamp in seconds)
gdnsl kv set cities --key k1 --value v1 --ttl 1671658506
# Add k1:v1 entry to cities collection with no expiration.
gdnsl kv set cities --key k1 --value v1
# Add [k1:v1, k2:v2, k3:v3] entries to cities collection.
gdnsl kv set cities --kv "k1:v1" --kv "k2:v2" --kv "k3:v3"
# Add [k1:v1, k2:v2, k3:v3] entries to cities collection with TTL.
gdnsl kv set cities --kv "k1:v1:1671658506" --kv "k2:v2:1645479306", --kv "k3:v3:-1"
@gdnsl/plugin-db kv update NAME
Enable stream on collection.
USAGE
$ @gdnsl/plugin-db kv update [NAME] [-h] [-c <value>] [--fabric <value>] [--stream] [--wait-for-sync]
ARGUMENTS
NAME Name of the kv collection.
FLAGS
-c, --config=<value> gdnsl config file (default is ./gdnsl.yaml).
-h, --help Help to enable stream on kv collection.
--fabric=<value> Name of the fabric. Default will be "_system"
--[no-]stream Enable / Disable kv collection stream.
--[no-]wait-for-sync Creating or changing a document will wait until the data has been synchronized to disk.
DESCRIPTION
Enable stream on collection.
EXAMPLES
# Enable stream on kv collection cities.
gdnsl kv update cities --stream
# Disable stream on kv collection cities.
gdnsl kv update cities --no-stream
# Enable waitForSync on kv collection cities.
gdnsl kv update cities --wait-for-sync
# Disable waitForSync on kv collection cities.
gdnsl kv update cities --no-wait-for-sync
# Enable stream and waitForSync on kv collection cities.
gdnsl kv update cities --stream --wait-for-sync
# Disable stream and waitForSync on kv collection cities.
gdnsl kv update cities --no-stream --no-wait-for-sync
@gdnsl/plugin-db query [QUERY]
Commands to work with GDN queries.
USAGE
$ @gdnsl/plugin-db query [QUERY] [-h] [--config <value>] [--fabric <value>] [--validate | --explain |
--batch-size <value> | --intermediate-commit-count <value> | --intermediate-commit-size <value> |
--max-transaction-size <value> | --max-warning-count <value> | --profile 1|2 | --ttl <value> | --optimizer-rule
<value> | --skip-inaccessible-collections | --stream | --fail-on-warning | --full-count | --count | --sql]
[--all-plans ] [--max-number-of-plans <value> ] [--file <value> | -p <value> | | | | | | | | | | | | |
| ]
ARGUMENTS
QUERY contains the query string to be executed
FLAGS
-h, --help
Help for queries.
-p, --param=<value>...
key=value pair representing the bind parameters
--all-plans
if set to true, all possible execution plans will be returned. The default is false, meaning only the optimal plan
will be returned
--batch-size=<value>
[default: 100] Sets the batch size of queries. This batch size decides how many results are returned as part of
query output. If this option is not specified, default value is used. Maximum allowed for this parameter is 1000
--config=<value>
gdnsl config file (default is ./gdnsl.yaml).
--count
return total document count of the collection in the response
--explain
explain a query
--fabric=<value>
Name of the fabric. Default will be "_system".
--fail-on-warning
When set to true, the query will throw an exception and abort instead of producing a warning. This option should be
used during development to catch potential issues early. When the attribute is set to false, warnings will not be
propagated to exceptions and will be returned with the query result.
--file=<value>
path to read the JSON file from
--full-count
if set to true and the query contains a LIMIT clause, then the result will have an extra attribute with the
sub-attributes stats and fullCount
--intermediate-commit-count=<value>
Maximum number of operations after which an intermediate commit is performed automatically. Note: Use this option
cautiously. The transactions are commited after every specific record count. In case of error, already commited
records are not rolled back
--intermediate-commit-size=<value>
Maximum total size of operations after which an intermediate commit is performed automatically, Note: Use this
option cautiously. The transactions are commited after every specific query memory size. In case of error, already
commited records are not rolled back.
--max-number-of-plans=<value>
an optional maximum number of plans that the optimizer is allowed to generate. Setting this attribute to a low value
allows to put a cap on the amount of work the optimizer does
--max-transaction-size=<value>
Transaction size limit in bytes
--max-warning-count=<value>
[default: 10] Limits the maximum number of warnings a query will return
--optimizer-rule=<value>...
to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling the optimizer to include or
exclude specific rules. To disable a rule, prefix its name with a -, to enable a rule, prefix it with a +. There is
also a pseudo-rule all, which will match all optimizer rules
--profile=<option>
If set to 1, then the additional query profiling information will be returned in the sub-attribute profile of the
extra return attribute, if the query result is not served from the query cache. Set to 2 the query will include
execution stats per query plan node in sub-attribute stats.nodes of the extra return attribute. Additionally the
query plan is returned in the sub-attribute extra.plan.
<options: 1|2>
--skip-inaccessible-collections
C8QL queries (especially graph traversals) will treat collection to which a user has no access rights as if these
collections were em