Skip to content

Commit 760ff69

Browse files
committed
Update docs
1 parent 8a77c9b commit 760ff69

13 files changed

Lines changed: 106 additions & 130 deletions

Cargo.lock

Lines changed: 12 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ url = "2.1"
5959
uuid = { version = "0.8", features = ["v4"] }
6060

6161
[dev-dependencies]
62-
nu-test-support = { version = "0.61.0"}
62+
nu-test-support = { version = "0.62.0"}
6363
dunce = "1.0.1"
6464
itertools = "0.10.3"
6565
lazy_static = "1.4.0"

docs/cloud.adoc renamed to docs/capella.adoc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
https://cloud.couchbase.com/sign-up?ref=cbsh-web-capella[Couchbase Capella] is a Database as a Service offering from Couchbase which you can interact with from Couchbase Shell.
44

5-
=== `use` and the Environment
5+
[#_cb_env_and_the_environment]
6+
=== `cb-env` and the Environment
67
7-
For general usage of the `use` command see <<_use_and_the_environment>>.
8-
When using <<_management_commands>> with Couchbase Capella and Couchbase Shell we need to be able to manage more active resources than the base `use` command gives us.
9-
You can use the `use --capella` command to see which cloud resources are current active:
8+
For general usage of the `cb-env` command see <<cbenv.adoc#_cb_env_and_the_environment>>.
9+
When using <<_management_commands>> with Couchbase Capella and Couchbase Shell we need to be able to manage more active resources than the base `cb-env` command gives us.
10+
You can use the `cb-env --capella` command to see which cloud resources are current active:
1011
1112
```
1213
> cb-env--capella
@@ -17,7 +18,7 @@ You can use the `use --capella` command to see which cloud resources are current
1718
──────────────────────┴──────────────────
1819
```
1920
20-
The active resource can be changed with the `use` command:
21+
The active resource can be changed with the `cb-env` command:
2122
2223
```
2324
> cb-env -h
@@ -42,11 +43,12 @@ Document level commands like those under `doc`, `analytics`, `query`, and `searc
4243
4344
You need to:
4445
45-
- https://docs.couchbase.com/cloud/clusters/create-cluster.html[create a cluster] in your Couchbase Capella account
46-
- ensure that your https://docs.couchbase.com/cloud/security/allow-ip-address.html[IP address is whitelisted]
47-
- ensure that you have a https://docs.couchbase.com/cloud/security/manage-database-users.html[database user]
48-
- Populate the relevant cluster section in the `config` file with the public address and database user credentials.
46+
- https://docs.couchbase.com/cloud/clusters/create-cluster.html[create a cluster] in your Couchbase Capella account
47+
- ensure that your https://docs.couchbase.com/cloud/security/allow-ip-address.html[IP address is whitelisted]
48+
- ensure that you have a https://docs.couchbase.com/cloud/security/manage-database-users.html[database user]
49+
- Populate the relevant cluster section in the `config` file with the public address and database user credentials.
4950
51+
[#_management_commands]
5052
=== Management Commands
5153
5254
Management commands (such as `cluster` and `bucket` management) require a specific section to be added to the `config` file as well as an extra entry in the relevant cluster section.

docs/use.adoc renamed to docs/cbenv.adoc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
== `use` and the Environment
1+
[#_cb_env_and_the_environment]
2+
== `cb-env` and the Environment
23
3-
While multiple clusters can be connected at the same time, there is only ever one cluster (at most) active.
4+
Whilst multiple clusters can be registered at the same time, there is only ever one cluster (at most) active.
45
The same is true for buckets, scopes, and collections.
56
When a resource is active then it used as the default to run commands against (this can be overridden on a per command basis).
67
7-
You can run the `use` command, which will tell you which resources are currently active (you are also able to tell from the prompt):
8+
You can run the `cb-env` command, which will tell you which resources are currently active (you are also able to tell from the prompt):
89
910
```
10-
> use
11+
> cb-env
1112
────────────┬───────────────
1213
username │ Susan
1314
cluster │ dev.local
@@ -25,8 +26,8 @@ If you were to now run a command then we would be running it:
2526
* Against the "inventory" scope
2627
* Against the "hotel" collection
2728
28-
You can also change the active resources with the `use` command.
29-
(Note there are extra resources listed here, see <<cloud.adoc#_use_and_the_environment>> for more information on these)
29+
You can also change the active resources with the `cb-env` command.
30+
(Note there are extra resources listed here, see <<capella.adoc#_cb_env_and_the_environment>> for more information on these)
3031
3132
```
3233
> cb-env -h
@@ -55,7 +56,7 @@ For example if you change the active bucket:
5556
```
5657
5758
```
58-
> use
59+
> cb-env
5960
────────────┬─────────────
6061
username │ Susan
6162
cluster │ dev.local
@@ -65,9 +66,9 @@ For example if you change the active bucket:
6566
────────────┴─────────────
6667
```
6768
68-
Both the output of `use` and the prompt will reflect the changes.
69+
Both the output of `cb-env` and the prompt will reflect the changes.
6970
70-
=== `Use`ing different execution environments
71+
=== Per command execution environments
7172
7273
On many commands you will notice a set of flags which allow you to override the active execution environment.
7374
Different commands support different flags, depending on the command you can expect to see any of:

docs/commands.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The following sections discuss the individual couchbase specific commands in gre
44

55
=== Working with `clusters`
66

7-
The `clusters managed` command lists all the clusters you specified in your configuration and the shell might be connected to.
7+
The `clusters managed` command lists all the clusters you have registered with the shell.
88

99
```
1010
> clusters managed

docs/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include::quickstart.adoc[]
1414

1515
include::intro.adoc[]
1616

17-
include::use.adoc[]
17+
include::cbenv.adoc[]
1818

1919
include::commands.adoc[]
2020

docs/intro.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ Couchbase Shell uses a custom, two line prompt to show you exactly in what envir
138138

139139
It tells you that your user is `Administrator`, the current active cluster identifier is `local` and the active bucket is `travel-sample`.
140140

141+
If you have an active scope or collection set then the prompt will also update to reflect that:
142+
143+
```
144+
👤 Administrator 🏠 dev.local in 🗄 travel-sample.myscope.mycollection
145+
>
146+
```
147+
141148
In the second line, your actual user prompt starts.
142149

143150
=== Pivot mode

docs/quickstart.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
=== Installation
44

5-
The current latest version is *1.0.0-beta.3*.
5+
The current latest version is *1.0.0-beta.4*.
66

77
There are a couple ways you can get access to `cbsh`, the easiest one is to download our pre-built binaries for your platform of choice:
88

9-
- Linux: https://github.com/couchbaselabs/couchbase-shell/releases/download/v1.0.0-beta.3/cbsh-1.0.0-beta.3-linux.tar.gz[cbsh-1.0.0-beta.3-linux.tar.gz]
10-
- macOS: https://github.com/couchbaselabs/couchbase-shell/releases/download/v1.0.0-beta.3/cbsh-1.0.0-beta.3-mac.zip[cbsh-1.0.0-beta.3-mac.zip]
11-
- Windows: https://github.com/couchbaselabs/couchbase-shell/releases/download/v1.0.0-beta.3/cbsh-1.0.0-beta.3-windows.zip[cbsh-1.0.0-beta.3-windows.zip]
9+
- Linux: https://github.com/couchbaselabs/couchbase-shell/releases/download/v1.0.0-beta.4/cbsh-1.0.0-beta.4-linux.tar.gz[cbsh-1.0.0-beta.4-linux.tar.gz]
10+
- macOS: https://github.com/couchbaselabs/couchbase-shell/releases/download/v1.0.0-beta.4/cbsh-1.0.0-beta.4-mac.zip[cbsh-1.0.0-beta.4-mac.zip]
11+
- Windows: https://github.com/couchbaselabs/couchbase-shell/releases/download/v1.0.0-beta.4/cbsh-1.0.0-beta.4-windows.zip[cbsh-1.0.0-beta.4-windows.zip]
1212

1313
Once you've downloaded the `zip` file, extract it and switch into the just created directory. The following example shows it for mac, but it works very similar if you are on linux (just align the commands with the file you just downloaded):
1414

1515
```
16-
$ unzip cbsh-1.0.0-beta.3-mac.zip
16+
$ unzip cbsh-1.0.0-beta.4-mac.zip
1717
$ ls
1818
cbsh examples LICENSE README.md
1919
```
@@ -22,7 +22,7 @@ You can now run the `cbsh` binary:
2222

2323
```
2424
❯ ./cbsh --version
25-
The Couchbase Shell 1.0.0-beta.3
25+
The Couchbase Shell 1.0.0-beta.4
2626
```
2727

2828
TIP: If you are running a recent macOS release (i.e. 10.15.x), you'll likely see an error similar to *"cbsh" was blocked from use because it is not from an identified developer*. This is because our binaries are not yet signed. To run it nonetheless you need to navigate to `System Preferences -> Security & Privacy` and click `Allow Anyway`. Next time you run the binary you'll get another prompt but then it should run fine.
@@ -91,6 +91,6 @@ password = "password"
9191
# password = "pass"
9292
```
9393

94-
This will connect to two clusters, one called `local` and one called `remote` (commented out). The file format is `toml` in case you wonder. Now when you start the shell, it will connect to `local` automatically and you are all set.
94+
This will register two clusters, one called `local` and one called `remote` (commented out). The file format is `toml` in case you wonder. Now when you start the shell, it will connect to `local` automatically and you are all set.
9595

9696
Please check out the reference section on additional parameters you can set as well as how to move the credentials to a separate `credentials` file in case you want to share your config with other people and they do not use the same credentials.

docs/recipes/importing-data.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Multiple Documents
6464
│ │ │ Rgnl │ │ States │ │ │ ago
6565
───┴──────┴─────────┴─────────────┴──────────┴─────────┴─────┴──────┴──────────────
6666

67-
> ls airports/ | open $it.name | each { wrap content | insert id {echo $it.content.airportname} } | doc upsert
67+
> ls airports/ | open $it.name | each { |it| wrap content | insert id {echo $it.content.airportname} } | doc upsert
6868
───┬───────────┬─────────┬────────
6969
# │ processed │ success │ failed
7070
───┼───────────┼─────────┼────────
@@ -80,7 +80,7 @@ Single Document
8080
id,cas,type,airportname,city,country,faa,icao,tz
8181
3719,1600344369374167040,airport,Columbia Rgnl,Columbia,United States,COU,KCOU,America/Chicago
8282

83-
> open mydoc.csv | each { wrap content | insert id {echo $it.content.airportname} } | doc upsert
83+
> open mydoc.csv | each { |it| wrap content | insert id {echo $it.content.airportname} } | doc upsert
8484
───┬───────────┬─────────┬────────
8585
# │ processed │ success │ failed
8686
───┼───────────┼─────────┼────────
@@ -98,7 +98,7 @@ Les Loges,Nangis,France,,LFAI,1256,airport,Europe/Paris
9898
Couterne,Bagnole-de-l'orne,France,,LFAO,1257,airport,Europe/Paris
9999
Bray,Albert,France,,LFAQ,1258,airport,Europe/Paris
100100

101-
> open airports.csv | each { wrap content | insert id {echo $it.content.airportname} } | doc upsert
101+
> open airports.csv | each { |it| wrap content | insert id {echo $it.content.airportname} } | doc upsert
102102
───┬───────────┬─────────┬────────
103103
# │ processed │ success │ failed
104104
───┼───────────┼─────────┼────────
@@ -170,7 +170,7 @@ Bray,Albert,France,,LFAQ,1258,Europe/Paris
170170

171171
We can also add a column based on data from other columns, for instance adding a `type` column which is set to the relevant country:
172172
```
173-
open ~/demo/airports.csv | each { insert type $it.city }
173+
open ~/demo/airports.csv | each { |it| insert type $it.city }
174174
───┬────────────┬────────────┬─────────┬─────┬──────┬──────┬────────────┬────────────
175175
# │ airportnam │ city │ country │ faa │ icao │ id │ tz │ type
176176
│ e │ │ │ │ │ │ │

docs/recipes/useful-snippets.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ A good example here is migrating from an on-premise cluster to a Capella cluster
99

1010
To migrate scopes, except the `_default` scope:
1111

12-
`scopes --clusters "On-Prem-Cluster" --bucket travel-sample | select scope | where scope != "_default" | each { scopes create $it.scope --clusters "Capella-Cluster" }`
12+
```
13+
scopes --clusters "On-Prem-Cluster" --bucket travel-sample | select scope | where scope != "_default" | each { |it| scopes create $it.scope --clusters "Capella-Cluster" }
14+
```
1315

1416
To migrate all collections, except the `_default` collection:
1517

16-
`collections --clusters "On-Prem-Cluster" --bucket "travel-sample" | select scope collection | where $it.scope != "_default" | where $it.collection != "_default" | each { collections create $it.collection --clusters "Capella-Cluster" --bucket "travel-sample-import" --scope $it.scope`
18+
```
19+
collections --clusters "On-Prem-Cluster" --bucket "travel-sample" | select scope collection | where $it.scope != "_default" | where $it.collection != "_default" | each { |it| collections create $it.collection --clusters "Capella-Cluster" --bucket "travel-sample-import" --scope $it.scope
20+
```
1721

1822
These examples can easily be extended to filter out any other scopes and collections you do not want to migrate.
1923
For example to filter more scopes you would just add more `where` clauses: `... | where scope != "_default" | where scope != "inventory" | ...`
@@ -25,4 +29,6 @@ A good example here is migrating from an on-premise cluster to a Capella cluster
2529

2630
To migrate all of your index definitions:
2731

28-
`query indexes --definitions --clusters "On-Prem-Cluster" | get definition | each { query $it --clusters "Capella-Cluster" }`
32+
```
33+
query indexes --definitions --clusters "On-Prem-Cluster" | get definition | each { |it| query $it --clusters "Capella-Cluster" }
34+
```

0 commit comments

Comments
 (0)