1 | fauna-shell
|
2 | ===========
|
3 |
|
4 | [![CircleCI](https://circleci.com/gh/fauna/fauna/tree/master.svg?style=shield)](https://circleci.com/gh/fauna/fauna/tree/master)
|
5 | [![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/fauna/fauna?branch=master&svg=true)](https://ci.appveyor.com/project/fauna/fauna/branch/master)
|
6 | [![Codecov](https://codecov.io/gh/fauna/fauna/branch/master/graph/badge.svg)](https://codecov.io/gh/fauna/fauna)
|
7 | [![Downloads/week](https://img.shields.io/npm/dw/fauna.svg)](https://npmjs.org/package/fauna)
|
8 | [![License](https://img.shields.io/npm/l/fauna.svg)](https://github.com/fauna/fauna/blob/master/package.json) -->
|
9 |
|
10 | This tools gives you access to [FaunaDB](http://fauna.com/) directly from your CLI.
|
11 |
|
12 | It also includes a [Shell](#shell) so you can issue queries to FaunaDB without needing to install additional libraries.
|
13 |
|
14 | You can install it via npm like this:
|
15 |
|
16 | ```sh-session
|
17 | $ npm install -g fauna-shell
|
18 | ```
|
19 |
|
20 |
|
21 | * [Usage](#usage)
|
22 | * [Shell](#shell)
|
23 | * [Command Details](#command-details)
|
24 | * [Connecting to different endpoints](#connecting-to-different-endpoints)
|
25 | * [Connecting to local endpoints](#connecting-to-local-endpoints)
|
26 | * [Overriding Connection Parameters](#overriding-connection-parameters)
|
27 | * [Executing queries from a file](#executing-queries-from-a-file)
|
28 | * [List of Commands](#list-of-commands)
|
29 |
|
30 |
|
31 | # Usage
|
32 |
|
33 | The **fauna-shell** allows you to do things like _creating_, _deleting_ and _listings_ databases.
|
34 |
|
35 | First lets configure our connection to the FaunaDB cloud. (If you don't have an account, you can create a free account [here](https://fauna.com/sign-up)).
|
36 |
|
37 | Let's run the following command:
|
38 |
|
39 | ```sh-session
|
40 | $ fauna cloud-login
|
41 | ```
|
42 |
|
43 | You will be prompted for your `email` and `password` from your [FaunaDB Cloud](https://dashboard.fauna.com/) account.
|
44 |
|
45 | Now that we have an endpoint to connect to we can try to create a database to start playing with FaunaDB. See [connecting to different endpoints](#connecting-to-different-endpoints).
|
46 |
|
47 | This is how you can create a database called `my_app`:
|
48 |
|
49 | ```sh-session
|
50 | $ fauna create-database my_app
|
51 | creating database my_app
|
52 |
|
53 | created database my_app
|
54 |
|
55 | To start a shell with your new database, run:
|
56 |
|
57 | fauna shell my_app
|
58 |
|
59 | Or, to create an application key for your database, run:
|
60 |
|
61 | fauna create-key my_app
|
62 | ```
|
63 |
|
64 | And then listing your databases:
|
65 |
|
66 | ```sh-session
|
67 | $ fauna list-databases
|
68 | listing databases
|
69 | my_app
|
70 | my_second_app
|
71 | my_other_app
|
72 | ```
|
73 |
|
74 | You can also delete a particular database:
|
75 |
|
76 | ```sh-session
|
77 | $ fauna delete-database my_other_app
|
78 | deleting database 'my_other_app'
|
79 | database 'my_other_app' deleted
|
80 | ```
|
81 |
|
82 | You can also `create`, `list`, and `delete` _keys_.
|
83 |
|
84 | This is how you create a key for the database `my_app`:
|
85 |
|
86 | ```sh-session
|
87 | $ fauna create-key my_app
|
88 | creating key for database 'my_app' with role 'admin'
|
89 |
|
90 | created key for database 'my_app' with role 'admin'.
|
91 | secret: ****************************************
|
92 |
|
93 | To access 'my_app' with this key, create a client using
|
94 | the driver library for your language of choice using
|
95 | the above secret.
|
96 | ```
|
97 |
|
98 | This is how to list keys (the results may differ from what you see in your instance of FaunaDB)
|
99 |
|
100 | ```sh-session
|
101 | $ fauna list-keys
|
102 | listing keys
|
103 | Key ID Database Role
|
104 | 203269476002562560 my_app admin
|
105 | 203269731203940864 my_app admin
|
106 | 203269732275585536 my_app admin
|
107 | 203269735610057216 test admin
|
108 | ```
|
109 |
|
110 | And then delete the key with id: `200219702370238976`:
|
111 |
|
112 | ```sh-session
|
113 | $ fauna delete-key 200219702370238976
|
114 | deleting key 200219702370238976
|
115 | key 200219702370238976 deleted
|
116 | ```
|
117 |
|
118 | See [Commands](#commands) for a list of commands and help on their usage.
|
119 |
|
120 | # Shell
|
121 |
|
122 | The Fauna Shell lets you issue queries directly to your FaunaDB instance without the need for installing additional libraries.
|
123 |
|
124 | Let's create a database and then we'll jump straight into the Shell to start playing with FaunaDB's data model.
|
125 |
|
126 | ```sh-session
|
127 | $ fauna create-database my_app
|
128 | ```
|
129 |
|
130 | Our next step is to start the shell for a specific database, in this case `my_app`:
|
131 |
|
132 | ```sh-session
|
133 | $ fauna shell my_app
|
134 | Starting shell for database my_app
|
135 | Connected to http://127.0.0.1:8443
|
136 | Type Ctrl+D or .exit to exit the shell
|
137 | my_app>
|
138 | ```
|
139 |
|
140 | Once you have the prompt ready, you can start issues queries against your FaunaDB instance. (Note that the results shown here might vary from the ones you see while running the examples).
|
141 |
|
142 | ```javascript
|
143 | my_app> CreateClass({ name: "posts" })
|
144 | { ref: Class("posts"),
|
145 | ts: 1532624109799742,
|
146 | history_days: 30,
|
147 | name: 'posts' }
|
148 | ```
|
149 |
|
150 | Let's create an index for our _posts_.
|
151 |
|
152 | ```javascript
|
153 | my_app> CreateIndex(
|
154 | {
|
155 | name: "posts_by_title",
|
156 | source: Class("posts"),
|
157 | terms: [{ field: ["data", "title"] }]
|
158 | })
|
159 | { ref: Index("posts_by_title"),
|
160 | ts: 1532624135128797,
|
161 | active: false,
|
162 | partitions: 1,
|
163 | name: 'posts_by_title',
|
164 | source: Class("posts"),
|
165 | terms: [ { field: [ 'data', 'title' ] } ] }
|
166 | ```
|
167 |
|
168 | Let's insert a _post_ item:
|
169 |
|
170 | ```javascript
|
171 | my_app> Create(
|
172 | Class("posts"),
|
173 | { data: { title: "What I had for breakfast .." } })
|
174 | { ref: Ref(Class("posts"), "205904004461363712"),
|
175 | ts: 1532624210670859,
|
176 | data: { title: 'What I had for breakfast ..' } }
|
177 | ```
|
178 |
|
179 | We can also insert items in bulk by using the `Map` function.
|
180 |
|
181 | ```javascript
|
182 | my_app> Map(
|
183 | [
|
184 | "My cat and other marvels",
|
185 | "Pondering during a commute",
|
186 | "Deep meanings in a latte"
|
187 | ],
|
188 | Lambda("post_title",
|
189 | Create(
|
190 | Class("posts"), { data: { title: Var("post_title") } }
|
191 | ))
|
192 | )
|
193 | [ { ref: Ref(Class("posts"), "205904031076321792"),
|
194 | ts: 1532624236071215,
|
195 | data: { title: 'My cat and other marvels' } },
|
196 | { ref: Ref(Class("posts"), "205904031076320768"),
|
197 | ts: 1532624236071215,
|
198 | data: { title: 'Pondering during a commute' } },
|
199 | { ref: Ref(Class("posts"), "205904031076319744"),
|
200 | ts: 1532624236071215,
|
201 | data: { title: 'Deep meanings in a latte' } } ]
|
202 | ```
|
203 |
|
204 | Now let's try to fetch our post about _latte_. We need to access it by _id_ like this:
|
205 |
|
206 | ```javascript
|
207 | my_app> Get(Ref(Class("posts"),"205904031076319744"))
|
208 | { ref: Ref(Class("posts"), "205904031076319744"),
|
209 | ts: 1532624236071215,
|
210 | data: { title: 'Deep meanings in a latte' } }
|
211 | ```
|
212 |
|
213 | Now let's update our post about our cat, by adding some tags:
|
214 |
|
215 | ```javascript
|
216 | my_app> Update(
|
217 | Ref(Class("posts"), "205904031076321792"),
|
218 | { data: { tags: ["pet", "cute"] } })
|
219 | { ref: Ref(Class("posts"), "205904031076321792"),
|
220 | ts: 1532624327263554,
|
221 | data:
|
222 | { title: 'My cat and other marvels', tags: [ 'pet', 'cute' ] } }
|
223 | ```
|
224 |
|
225 | And now let's try to change the content of that post:
|
226 |
|
227 | ```javascript
|
228 | my_app> Replace(
|
229 | Ref(Class("posts"), "205904031076321792"),
|
230 | { data: { title: "My dog and other marvels" } })
|
231 | { ref: Ref(Class("posts"), "205904031076321792"),
|
232 | ts: 1532624352388889,
|
233 | data: { title: 'My dog and other marvels' } }
|
234 | ```
|
235 |
|
236 | Now let's try to delete our post about _latte_:
|
237 |
|
238 | ```javascript
|
239 | my_app> Delete(Ref(Class("posts"), "205904031076319744"))
|
240 | { ref: Ref(Class("posts"), "205904031076319744"),
|
241 | ts: 1532624236071215,
|
242 | data: { title: 'Deep meanings in a latte' } }
|
243 | ```
|
244 |
|
245 | If we try to fetch it, we will receive an error:
|
246 |
|
247 | ```javascript
|
248 | my_app> Get(Ref(Class("posts"), "205904031076319744"))
|
249 | Error: instance not found
|
250 | ```
|
251 |
|
252 | Finally you can exit the _shell_ by pressing `ctrl+d`.
|
253 |
|
254 | # Command Details
|
255 |
|
256 | ```sh-session
|
257 | $ fauna COMMAND
|
258 | running command...
|
259 | $ fauna (-v|--version|version)
|
260 | fauna/0.0.1 darwin-x64 node-v8.11.1
|
261 | $ fauna --help [COMMAND]
|
262 | USAGE
|
263 | $ fauna COMMAND
|
264 | ...
|
265 | ```
|
266 |
|
267 | # Connecting to different endpoints
|
268 |
|
269 | We can add endpoints by calling the following command `add-endpoint`. We will be prompted to enter the authentication key and an alias for the endpoint.
|
270 |
|
271 | ```sh-session
|
272 | $ fauna add-endpoint "https://example.com"
|
273 | Endpoint Key: ****************************************
|
274 | Endpoint Alias [example.com]: example_alias
|
275 | ```
|
276 |
|
277 | The _Endpoint Alias_ should be a name that helps you remember the purpose of this endpoint.
|
278 |
|
279 | If we have defined many endpoints, we could set one of them as the default one with the `default-endpoint` command:
|
280 |
|
281 | ```sh-session
|
282 | $ fauna default-endpoint cloud
|
283 | ```
|
284 |
|
285 | The _default endpoint_ will be used by the shell to connect to FaunaDB.
|
286 |
|
287 | Endpoints can be listed with the `list-endpoints` command like this:
|
288 |
|
289 | ```sh-session
|
290 | $ fauna list-endpoints
|
291 | localhost
|
292 | cloud *
|
293 | cluster-us-east
|
294 | ```
|
295 |
|
296 | There we see that the `cloud` endpoint has a `*` next to its name, meaning that it's the current default one.
|
297 |
|
298 | Finally, endpoints will be saved to a `~/.fauna-shell` file like this:
|
299 |
|
300 | ```ini
|
301 | default=cloud
|
302 |
|
303 | [localhost]
|
304 | domain=127.0.0.1
|
305 | port=8443
|
306 | scheme=http
|
307 | secret=the_secret
|
308 |
|
309 | [cloud]
|
310 | domain=db.fauna.com
|
311 | scheme=https
|
312 | secret=FAUNA_SECRET_KEY
|
313 |
|
314 | [cluster-us-east]
|
315 | domain=cluster-us-east.example.com
|
316 | port=443
|
317 | scheme=https
|
318 | secret=OTHER_FAUNA_SECRET
|
319 | ```
|
320 |
|
321 | # Connecting to local endpoints
|
322 |
|
323 | If you are running Fauna locally using our Docker images, you may need to configure the Shell to work with local endpoints so you can interact with the databases running in the Docker containers.
|
324 |
|
325 | Once you've installed the Shell and logged in, you can configure this by doing the following:
|
326 |
|
327 | 1. Run `fauna list-endpoints` to see all your endpoints. If you haven't added any yet, you should just see the `cloud` endpoint that was added when you went through the login flow.
|
328 |
|
329 | 2. By default, the Fauna Docker image serves data via port 8443 (check your Docker logs to confirm the port number). To add this, run the follwing:
|
330 |
|
331 | ```bash
|
332 | fauna add-endpoint http://localhost:8443 # Doesn't work with HTTPS
|
333 | ```
|
334 |
|
335 | 3. When prompted, provide the endpint key and then give it a name (ex. `localhost`)
|
336 |
|
337 | 4. Now, you can interact with your local database through the Fauna Shell by running the command below:
|
338 |
|
339 | ```bash
|
340 | fauna shell --endpoint localhost
|
341 | ```
|
342 |
|
343 | # Overriding Connection Parameters
|
344 |
|
345 | Most commands support the following options. You can specify them if you want to connect to your local FaunaDB instance.
|
346 |
|
347 | ```
|
348 | OPTIONS
|
349 | --domain=domain [default: db.fauna.com] FaunaDB server domain
|
350 | --port=port [default: 443] Connection port
|
351 | --scheme=https|http [default: https] Connection scheme
|
352 | --secret=secret FaunaDB secret key
|
353 | --timeout=timeout [default: 80] Connection timeout in milliseconds
|
354 | --endpoint=alias Overrides the default endpoint set in ~/.fauna-shell
|
355 | ```
|
356 |
|
357 | They can be used like this:
|
358 |
|
359 | ```sh-session
|
360 | $ fauna create-database testdb --domain=127.0.0.1 port=8443 --scheme=http --secret=YOUR_FAUNA_SECRET_KEY --timeout=42
|
361 | ```
|
362 |
|
363 | Options provided via the CLI will override the values set in the `.fauna-shell` config file.
|
364 |
|
365 | For example you can start a shell to a different endpoint from the one set in `.fauna-shell`:
|
366 |
|
367 | ```sh-session
|
368 | $ fauna shell my_app --endpoint=endpoint_alias
|
369 | ```
|
370 |
|
371 | Any options that are not specified either via the `.fauna-shell` config file or the CLI will be set to the defaults offered by the [faunadb-js client](https://github.com/fauna/faunadb-js).
|
372 |
|
373 | # Executing queries from a file
|
374 |
|
375 | You can also tell the shell to execute a list of queries that you have stored in a file. For example, you can have a filed called `queries.fql` with the following content:
|
376 |
|
377 | ```javascript
|
378 | CreateClass({ name: "posts" });
|
379 | CreateIndex(
|
380 | {
|
381 | name: "posts_by_title",
|
382 | source: Class("posts"),
|
383 | terms: [{ field: ["data", "title"] }]
|
384 | });
|
385 | Create(
|
386 | Class("posts"),
|
387 | { data: { title: "What I had for breakfast .." } });
|
388 | Map(
|
389 | [
|
390 | "My cat and other marvels",
|
391 | "Pondering during a commute",
|
392 | "Deep meanings in a latte"
|
393 | ],
|
394 | Lambda("post_title",
|
395 | Create(
|
396 | Class("posts"), { data: { title: Var("post_title") } }
|
397 | ))
|
398 | );
|
399 | ```
|
400 |
|
401 | You can tell Fauna Shell to execute all those queries for you by running the following command:
|
402 |
|
403 | ```bash
|
404 | $ fauna run-queries my_app --file=./queries.fql
|
405 | ```
|
406 |
|
407 | Where `my_app` is the name of your database, and `./queries.fql` is the path to the file where you saved the queries.
|
408 |
|
409 | Queries have to be written in the syntax supported by FaunaDB's Javascript [driver](https://github.com/fauna/faunadb-js).
|
410 |
|
411 |
|
412 | # List of Commands
|
413 |
|
414 | * [`fauna add-endpoint ENDPOINT`](#fauna-add-endpoint-endpoint)
|
415 | * [`fauna autocomplete [SHELL]`](#fauna-autocomplete-shell)
|
416 | * [`fauna cloud-login`](#fauna-cloud-login)
|
417 | * [`fauna create-database DBNAME`](#fauna-create-database-dbname)
|
418 | * [`fauna create-key DBNAME [ROLE]`](#fauna-create-key-dbname-role)
|
419 | * [`fauna default-endpoint ENDPOINT_ALIAS`](#fauna-default-endpoint-endpoint_alias)
|
420 | * [`fauna delete-database DBNAME`](#fauna-delete-database-dbname)
|
421 | * [`fauna delete-endpoint ENDPOINT_ALIAS`](#fauna-delete-endpoint-endpoint_alias)
|
422 | * [`fauna delete-key KEYNAME`](#fauna-delete-key-keyname)
|
423 | * [`fauna eval [QUERY]`](#fauna-eval-query)
|
424 | * [`fauna help [COMMAND]`](#fauna-help-command)
|
425 | * [`fauna list-databases`](#fauna-list-databases)
|
426 | * [`fauna list-endpoints`](#fauna-list-endpoints)
|
427 | * [`fauna list-keys`](#fauna-list-keys)
|
428 | * [`fauna run-queries [QUERY]`](#fauna-run-queries-query)
|
429 | * [`fauna shell [DBNAME]`](#fauna-shell-dbname)
|
430 |
|
431 | ## `fauna add-endpoint ENDPOINT`
|
432 |
|
433 | Adds a connection endpoint for FaunaDB
|
434 |
|
435 | ```
|
436 | USAGE
|
437 | $ fauna add-endpoint ENDPOINT
|
438 |
|
439 | ARGUMENTS
|
440 | ENDPOINT FaunaDB server endpoint
|
441 |
|
442 | OPTIONS
|
443 | --alias=alias FaunaDB server endpoint alias
|
444 | --key=key FaunaDB server endpoint key
|
445 |
|
446 | DESCRIPTION
|
447 | Adds a connection endpoint for FaunaDB
|
448 |
|
449 | EXAMPLES
|
450 | $ fauna add-endpoint https://db.fauna.com:443
|
451 | $ fauna add-endpoint http://localhost:8443/ --alias localhost --key secret
|
452 | ```
|
453 |
|
454 | _See code: [src/commands/add-endpoint.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/add-endpoint.js)_
|
455 |
|
456 | ## `fauna autocomplete [SHELL]`
|
457 |
|
458 | display autocomplete installation instructions
|
459 |
|
460 | ```
|
461 | USAGE
|
462 | $ fauna autocomplete [SHELL]
|
463 |
|
464 | ARGUMENTS
|
465 | SHELL shell type
|
466 |
|
467 | OPTIONS
|
468 | -r, --refresh-cache Refresh cache (ignores displaying instructions)
|
469 |
|
470 | EXAMPLES
|
471 | $ fauna autocomplete
|
472 | $ fauna autocomplete bash
|
473 | $ fauna autocomplete zsh
|
474 | $ fauna autocomplete --refresh-cache
|
475 | ```
|
476 |
|
477 | _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v0.1.4/src/commands/autocomplete/index.ts)_
|
478 |
|
479 | ## `fauna cloud-login`
|
480 |
|
481 | Adds the FaunaDB Cloud endpoint
|
482 |
|
483 | ```
|
484 | USAGE
|
485 | $ fauna cloud-login
|
486 |
|
487 | OPTIONS
|
488 | --domain=domain FaunaDB server domain
|
489 | --endpoint=endpoint FaunaDB server endpoint
|
490 | --port=port Connection port
|
491 | --scheme=https|http Connection scheme
|
492 | --secret=secret FaunaDB secret key
|
493 | --timeout=timeout Connection timeout in milliseconds
|
494 |
|
495 | DESCRIPTION
|
496 | Adds the FaunaDB Cloud endpoint
|
497 |
|
498 | EXAMPLE
|
499 | $ fauna cloud-login
|
500 | ```
|
501 |
|
502 | _See code: [src/commands/cloud-login.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/cloud-login.js)_
|
503 |
|
504 | ## `fauna create-database DBNAME`
|
505 |
|
506 | Creates a database
|
507 |
|
508 | ```
|
509 | USAGE
|
510 | $ fauna create-database DBNAME
|
511 |
|
512 | ARGUMENTS
|
513 | DBNAME database name
|
514 |
|
515 | OPTIONS
|
516 | --domain=domain FaunaDB server domain
|
517 | --endpoint=endpoint FaunaDB server endpoint
|
518 | --port=port Connection port
|
519 | --scheme=https|http Connection scheme
|
520 | --secret=secret FaunaDB secret key
|
521 | --timeout=timeout Connection timeout in milliseconds
|
522 |
|
523 | DESCRIPTION
|
524 | Creates a database
|
525 |
|
526 | EXAMPLE
|
527 | $ fauna create-database dbname
|
528 | ```
|
529 |
|
530 | _See code: [src/commands/create-database.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/create-database.js)_
|
531 |
|
532 | ## `fauna create-key DBNAME [ROLE]`
|
533 |
|
534 | Creates a key for the specified database
|
535 |
|
536 | ```
|
537 | USAGE
|
538 | $ fauna create-key DBNAME [ROLE]
|
539 |
|
540 | ARGUMENTS
|
541 | DBNAME database name
|
542 | ROLE (admin|server|server-readonly|client) key user role
|
543 |
|
544 | OPTIONS
|
545 | --domain=domain FaunaDB server domain
|
546 | --endpoint=endpoint FaunaDB server endpoint
|
547 | --port=port Connection port
|
548 | --scheme=https|http Connection scheme
|
549 | --secret=secret FaunaDB secret key
|
550 | --timeout=timeout Connection timeout in milliseconds
|
551 |
|
552 | DESCRIPTION
|
553 | Creates a key for the specified database
|
554 |
|
555 | EXAMPLE
|
556 | $ fauna create-key dbname admin
|
557 | ```
|
558 |
|
559 | _See code: [src/commands/create-key.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/create-key.js)_
|
560 |
|
561 | ## `fauna default-endpoint ENDPOINT_ALIAS`
|
562 |
|
563 | Sets an endpoint as the default one
|
564 |
|
565 | ```
|
566 | USAGE
|
567 | $ fauna default-endpoint ENDPOINT_ALIAS
|
568 |
|
569 | ARGUMENTS
|
570 | ENDPOINT_ALIAS FaunaDB server endpoint alias
|
571 |
|
572 | DESCRIPTION
|
573 | Sets an endpoint as the default one
|
574 |
|
575 | EXAMPLE
|
576 | $ fauna default-endpoint endpoint
|
577 | ```
|
578 |
|
579 | _See code: [src/commands/default-endpoint.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/default-endpoint.js)_
|
580 |
|
581 | ## `fauna delete-database DBNAME`
|
582 |
|
583 | Deletes a database
|
584 |
|
585 | ```
|
586 | USAGE
|
587 | $ fauna delete-database DBNAME
|
588 |
|
589 | ARGUMENTS
|
590 | DBNAME database name
|
591 |
|
592 | OPTIONS
|
593 | --domain=domain FaunaDB server domain
|
594 | --endpoint=endpoint FaunaDB server endpoint
|
595 | --port=port Connection port
|
596 | --scheme=https|http Connection scheme
|
597 | --secret=secret FaunaDB secret key
|
598 | --timeout=timeout Connection timeout in milliseconds
|
599 |
|
600 | DESCRIPTION
|
601 | Deletes a database
|
602 |
|
603 | EXAMPLE
|
604 | $ fauna delete-database dbname
|
605 | ```
|
606 |
|
607 | _See code: [src/commands/delete-database.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/delete-database.js)_
|
608 |
|
609 | ## `fauna delete-endpoint ENDPOINT_ALIAS`
|
610 |
|
611 | Deletes a connection endpoint for FaunaDB
|
612 |
|
613 | ```
|
614 | USAGE
|
615 | $ fauna delete-endpoint ENDPOINT_ALIAS
|
616 |
|
617 | ARGUMENTS
|
618 | ENDPOINT_ALIAS FaunaDB server endpoint alias
|
619 |
|
620 | DESCRIPTION
|
621 | Deletes a connection endpoint for FaunaDB
|
622 |
|
623 | EXAMPLE
|
624 | $ fauna delete-endpoint endpoint_alias
|
625 | ```
|
626 |
|
627 | _See code: [src/commands/delete-endpoint.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/delete-endpoint.js)_
|
628 |
|
629 | ## `fauna delete-key KEYNAME`
|
630 |
|
631 | Deletes a key
|
632 |
|
633 | ```
|
634 | USAGE
|
635 | $ fauna delete-key KEYNAME
|
636 |
|
637 | ARGUMENTS
|
638 | KEYNAME key name
|
639 |
|
640 | OPTIONS
|
641 | --domain=domain FaunaDB server domain
|
642 | --endpoint=endpoint FaunaDB server endpoint
|
643 | --port=port Connection port
|
644 | --scheme=https|http Connection scheme
|
645 | --secret=secret FaunaDB secret key
|
646 | --timeout=timeout Connection timeout in milliseconds
|
647 |
|
648 | DESCRIPTION
|
649 | Deletes a key
|
650 |
|
651 | EXAMPLE
|
652 | $ fauna delete-key 123456789012345678
|
653 | ```
|
654 |
|
655 | _See code: [src/commands/delete-key.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/delete-key.js)_
|
656 |
|
657 | ## `fauna eval [QUERY]`
|
658 |
|
659 | Runs the specified query. Can read from stdin, file or command line.
|
660 |
|
661 | ```
|
662 | USAGE
|
663 | $ fauna eval [QUERY]
|
664 |
|
665 | ARGUMENTS
|
666 | QUERY FQL query to execute
|
667 |
|
668 | OPTIONS
|
669 | --domain=domain FaunaDB server domain
|
670 | --endpoint=endpoint FaunaDB server endpoint
|
671 | --file=file File where to read queries from
|
672 | --format=json|shell [default: json] Output format
|
673 | --output=output File to write output to
|
674 | --port=port Connection port
|
675 | --scheme=https|http Connection scheme
|
676 | --secret=secret FaunaDB secret key
|
677 | --stdin Read file input from stdin. Writes to stdout by default
|
678 | --timeout=timeout Connection timeout in milliseconds
|
679 |
|
680 | DESCRIPTION
|
681 | Runs the specified query. Can read from stdin, file or command line.
|
682 | Outputs to either stdout or file.
|
683 | Output format can be specified.
|
684 |
|
685 | EXAMPLES
|
686 | $ fauna eval "Paginate(Classes())"
|
687 | $ fauna eval --file=/path/to/queries.fql
|
688 | $ echo "Add(1,1)" | fauna eval --stdin
|
689 | $ fauna eval "Add(2,3)" --output=/tmp/result"
|
690 | $ fauna eval "Add(2,3)" --format=json --output=/tmp/result"
|
691 | ```
|
692 |
|
693 | _See code: [src/commands/eval.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/eval.js)_
|
694 |
|
695 | ## `fauna help [COMMAND]`
|
696 |
|
697 | display help for fauna
|
698 |
|
699 | ```
|
700 | USAGE
|
701 | $ fauna help [COMMAND]
|
702 |
|
703 | ARGUMENTS
|
704 | COMMAND command to show help for
|
705 |
|
706 | OPTIONS
|
707 | --all see all commands in CLI
|
708 | ```
|
709 |
|
710 | _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v1.2.11/src/commands/help.ts)_
|
711 |
|
712 | ## `fauna list-databases`
|
713 |
|
714 | Lists top level databases
|
715 |
|
716 | ```
|
717 | USAGE
|
718 | $ fauna list-databases
|
719 |
|
720 | OPTIONS
|
721 | --domain=domain FaunaDB server domain
|
722 | --endpoint=endpoint FaunaDB server endpoint
|
723 | --port=port Connection port
|
724 | --scheme=https|http Connection scheme
|
725 | --secret=secret FaunaDB secret key
|
726 | --timeout=timeout Connection timeout in milliseconds
|
727 |
|
728 | DESCRIPTION
|
729 | Lists top level databases
|
730 |
|
731 | EXAMPLE
|
732 | $ fauna list-databases
|
733 | ```
|
734 |
|
735 | _See code: [src/commands/list-databases.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/list-databases.js)_
|
736 |
|
737 | ## `fauna list-endpoints`
|
738 |
|
739 | Lists FaunaDB connection endpoints
|
740 |
|
741 | ```
|
742 | USAGE
|
743 | $ fauna list-endpoints
|
744 |
|
745 | DESCRIPTION
|
746 | Lists FaunaDB connection endpoints
|
747 |
|
748 | EXAMPLE
|
749 | $ fauna list-endpoints
|
750 | ```
|
751 |
|
752 | _See code: [src/commands/list-endpoints.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/list-endpoints.js)_
|
753 |
|
754 | ## `fauna list-keys`
|
755 |
|
756 | Lists top level keys
|
757 |
|
758 | ```
|
759 | USAGE
|
760 | $ fauna list-keys
|
761 |
|
762 | OPTIONS
|
763 | --domain=domain FaunaDB server domain
|
764 | --endpoint=endpoint FaunaDB server endpoint
|
765 | --port=port Connection port
|
766 | --scheme=https|http Connection scheme
|
767 | --secret=secret FaunaDB secret key
|
768 | --timeout=timeout Connection timeout in milliseconds
|
769 |
|
770 | DESCRIPTION
|
771 | Lists top level keys
|
772 |
|
773 | EXAMPLE
|
774 | $ fauna list-keys
|
775 | ```
|
776 |
|
777 | _See code: [src/commands/list-keys.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/list-keys.js)_
|
778 |
|
779 | ## `fauna run-queries [QUERY]`
|
780 |
|
781 | Deprecated: fauna run-queries is deprecated. Use eval instead
|
782 |
|
783 | ```
|
784 | USAGE
|
785 | $ fauna run-queries [QUERY]
|
786 |
|
787 | ARGUMENTS
|
788 | QUERY FQL query to execute
|
789 |
|
790 | OPTIONS
|
791 | --domain=domain FaunaDB server domain
|
792 | --endpoint=endpoint FaunaDB server endpoint
|
793 | --file=file (required) File where to read queries from
|
794 | --port=port Connection port
|
795 | --scheme=https|http Connection scheme
|
796 | --secret=secret FaunaDB secret key
|
797 | --timeout=timeout Connection timeout in milliseconds
|
798 |
|
799 | DESCRIPTION
|
800 | Deprecated: fauna run-queries is deprecated. Use eval instead
|
801 | Runs the queries found on the file passed to the command.
|
802 |
|
803 | EXAMPLE
|
804 | $ fauna run-queries dbname --file=/path/to/queries.fql
|
805 | ```
|
806 |
|
807 | _See code: [src/commands/run-queries.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/run-queries.js)_
|
808 |
|
809 | ## `fauna shell [DBNAME]`
|
810 |
|
811 | Starts a FaunaDB shell
|
812 |
|
813 | ```
|
814 | USAGE
|
815 | $ fauna shell [DBNAME]
|
816 |
|
817 | ARGUMENTS
|
818 | DBNAME database name
|
819 |
|
820 | OPTIONS
|
821 | --domain=domain FaunaDB server domain
|
822 | --endpoint=endpoint FaunaDB server endpoint
|
823 | --port=port Connection port
|
824 | --scheme=https|http Connection scheme
|
825 | --secret=secret FaunaDB secret key
|
826 | --timeout=timeout Connection timeout in milliseconds
|
827 |
|
828 | DESCRIPTION
|
829 | Starts a FaunaDB shell
|
830 |
|
831 | EXAMPLE
|
832 | $ fauna shell dbname
|
833 | ```
|
834 |
|
835 | _See code: [src/commands/shell.js](https://github.com/fauna/fauna-shell/blob/v0.11.4/src/commands/shell.js)_
|
836 |
|