all repos — litestore @ 0e985d33360bd191d6a693e28c2c243d0e8bed15

A minimalist nosql document store.

src/admin/md/usage.md

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
## Usage

### Command Line Syntax

[litestore](class:kwd) **[** _command_ **]** **[** _option1_, _option2_, ... **]**

#### Commands

* **run** — Start LiteStore server (default if no command specified).
* **delete** — Delete a previously-imported specified directory (requires -d).
* **execute** — Execute an operation on data stored in the datastore (requires -o, -u, and in certain cases -f or -b and -t).
* **import** — Import the specified directory into the datastore (requires -d).
* **export** — Export the previously-imported specified directory to the current directory (requires -d).
* **optimize** — Optimize search indexes.
* **vacuum** — Vacuum datastore.

#### Options

* **-a**, **-\-address** — Specify server address (default: 127.0.0.1).
* **-b**, **--body** — Specify a string containing input data for an operation to be executed.
* **-d**, **-\-directory** — Specify a directory to serve, import, export, delete, or mount.
* **-f**, **--file** — Specify a file containing input data for an operation to be executed.
* **-h**, **-\-help** — Display program usage.
* **-l**, **-\-log** — Specify the log level: debug, info, warn, error, none (default: info)
* **-m**, **-\-mount** — Mirror database changes to the specified directory on the filesystem.
* **-o**, **--operation** — Specify an operation to execute via the execute command: get, put, delete, patch, post, head, options.
* **-p**, **-\-port** —Specify server port number (default: 9500).
* **-r**, **-\-readonly** — Allow only data retrieval operations.
* **-s**, **-\-store** — Specify a datastore file (default: data.db)
* **-t**, **--type** — Specify a content type for the body an operation to be executed via the execute command.
* **-u**, **--uri** — Specify an uri to execute an operation through the execute command.
* **-v**, **-\-version** — Display the program version.

### Examples

#### Starting the HTTP Server

* with default settings:
  
  [litestore](class:cmd)
* with custom port (**9700**) and address (**0.0.0.0**):
 
  [litestore -p:9700 -a:0.0.0.0](class:cmd)

* in read-only mode with logging level set to **debug**:

  [litestore -r -l:debug](class:cmd)
  
* serving the contents of a directory called **admin**:

  [litestore -d:admin](class:cmd)

* mouting a directory called **admin** (changes will be mirrored to filesystem, directory contents will be served):

  [litestore -d:admin -m](class:cmd)

#### Importing a directory

Import a directory called **admin**:

[litestore import -d:admin](class:cmd)

#### Exporting a directory

Export all documents tagged with **$dir:admin** to a local directory called **admin**:

[litestore export -d:admin](class:cmd)

#### Deleting documents within a directory

Delete all documents tagged with **$dir:admin**:

[litestore delete -d:admin](class:cmd)

#### Performing maintenance operations

* vacuum SQlite database:

  [litestore vacuum](class:cmd)

* optimize search index:

  [litestore optimize](class:cmd)

#### Executing operations

* Retrieve all documents tagged with `$subtype:json`:

  [litestore execute -o:get -u:docs?tags=$subtype:json](class:cmd)

* Add a new document from a JSON file:

  [litestore execute -o:put -u:docs/test-doc -f:test.json -t:application/json](class:cmd)