You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -110,17 +116,33 @@ These will be set to the imports of `bignumber.js` and `json-bigint`, respective
110
116
'{"num":36.03}'
111
117
```
112
118
113
-
#### `client`, `db`, `coll`, `table`
119
+
#### `client`, `db`
120
+
121
+
Yeah, these are exactly what you think they are. Just remember that it is entirely on you to ensure that the database actually exists.
122
+
123
+
```ts
124
+
>awaitdb.info()
125
+
{ ... }
126
+
```
127
+
128
+
#### `coll`, `table`, `coll_`, `table_` 🚨
114
129
115
-
Yeah, these are exactly what you think they are. Just remember that it is entirely on you to ensure that the db/keyspace/collection/table actually exist.
130
+
Yeah, these are exactly what you think they are. Just remember that it is entirely on you to ensure that the database actually exists.
116
131
117
132
Running the test script beforehand will set these up for you automatically (assuming the coll/table/ks names are left as default).
118
133
119
134
```ts
120
-
>awaitcoll.options()
135
+
>awaittable.definition()
121
136
{ ... }
122
137
```
123
138
139
+
> [!IMPORTANT]
140
+
> These variables are **special**; they are wrapped in a custom `Proxy` which allows property access to be _case-insensitive_ and _partially-complete_.
141
+
142
+
This means that you can access properties like `table.findOne({})` or `table.findOn({})` or `table.findo({})` and they will all work the same.
143
+
144
+
The shortest matching property will be used, so `insert` will match `insertOne` instead of `insertMany`.
145
+
124
146
#### `dbAdmin`, `admin`, `isAstra`
125
147
126
148
-`isAstra` will be set to `true` if the `CLIENT_DB_ENVIRONMENT` is `'astra' | undefined` and `-local` is not set
@@ -151,9 +173,9 @@ Just typing `cl` into the REPL will clear the console. It's like magic.
151
173
>
152
174
```
153
175
154
-
#### `cda`/`tda`
176
+
#### `cda`/`tda`/`cda_`/`tda_`
155
177
156
-
Just typing in `cda` or `tda` into the REPL will run `await coll/table.deleteMany({})` for you.
178
+
Just typing in `cda` or `tda` into the REPL will run `await coll/table.deleteMany({})` for you. Ditto for their `_` counterparts.
157
179
158
180
No explicit `await` required! Just type it in and watch the magic (synchronously) happen.
159
181
@@ -162,9 +184,9 @@ No explicit `await` required! Just type it in and watch the magic (synchronously
162
184
{ deletedCount: -1 }
163
185
```
164
186
165
-
#### `cfa`/`tfa`
187
+
#### `cfa`/`tfa`/`cfa_`/`tfa_`
166
188
167
-
Just typing in `cfa` or `tfa` into the REPL will run `await coll/table.find({}).toArray()` for you.
189
+
Just typing in `cfa` or `tfa` into the REPL will run `await coll/table.find({}).toArray()` for you. Ditto for their `_` counterparts.
168
190
169
191
No explicit `await` required! Just type it in and watch the magic (synchronously) happen.
170
192
@@ -215,6 +237,43 @@ It'll also return `1` if the promise resolves successfully, and `0` if it reject
215
237
1
216
238
```
217
239
240
+
### Configuration (`cfg`)
241
+
242
+
The `cfg` variable is a utility object that allows you to configure certain aspects the REPL environment.
243
+
244
+
```ts
245
+
>cfg.plusOutput.minimal
246
+
"Set plus output to 'minimal'"
247
+
>cfg.fa.project({})
248
+
'Set *fa projection to {}'
249
+
```
250
+
251
+
#### `cfg.plusOutput`
252
+
253
+
This configuration object allows you to set the output level of the `+<Promise>` macro.
254
+
255
+
The available options are:
256
+
-`cfg.plusOutput.default`: Prints the default output level
257
+
-`cfg.plusOutput.verbose`: Prints the same as the default, but prints the whole error object if the promise rejects
258
+
-`cfg.plusOutput.minimal`: Prints only the response or error message, and nothing else
259
+
260
+
#### `cfg.logging`
261
+
262
+
This configuration object allows you to manage the logging of events emitted by the various client objects.
263
+
264
+
The available options are:
265
+
-`cfg.logging.on`: Enables logging
266
+
-`cfg.logging.off`: Disables logging
267
+
268
+
The default value is set by the [`-l` flag](#enabling-verbose-logging--l---logging) if it is set, otherwise it will be `false`.
269
+
270
+
#### `cfg.fa`
271
+
272
+
This configuration object allows you to set options regarding the [`*fa` utility macros](#cfatfacfa_tfa_) (such as `cfa` or `tfa_`).
273
+
274
+
The available options are:
275
+
-`cfg.fa.project(projection)`: Sets the projection to be used in the `find` query. The default is `{ '*': 1 }`, which means all fields will be returned.
0 commit comments