@cli4ai/mongodb 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/c4ai.json +1 -1
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @cli4ai/mongodb
|
|
2
|
+
|
|
3
|
+
> Official @cli4ai package • https://cli4ai.com • Install c4ai: `npm i -g c4ai`
|
|
4
|
+
|
|
5
|
+
MongoDB explorer and query helper (JSON in/out).
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -g c4ai
|
|
11
|
+
c4ai add -g mongodb
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Optional: set a default connection URI (defaults to `mongodb://localhost:27017`):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
c4ai secrets set MONGO_URI
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
c4ai run mongodb databases
|
|
24
|
+
c4ai run mongodb collections <db>
|
|
25
|
+
c4ai run mongodb schema <db> <collection> [samples]
|
|
26
|
+
c4ai run mongodb find <db> <collection> [queryJson] [limit]
|
|
27
|
+
c4ai run mongodb one <db> <collection> [queryJson]
|
|
28
|
+
c4ai run mongodb aggregate <db> <collection> <pipelineJson>
|
|
29
|
+
c4ai run mongodb count <db> <collection> [queryJson]
|
|
30
|
+
c4ai run mongodb indexes <db> <collection>
|
|
31
|
+
c4ai run mongodb stats <db> <collection>
|
|
32
|
+
c4ai run mongodb distinct <db> <collection> <field> [queryJson]
|
|
33
|
+
c4ai run mongodb sample <db> <collection> [size]
|
|
34
|
+
c4ai run mongodb explain <db> <collection> [queryJson]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# List databases
|
|
41
|
+
c4ai run mongodb databases
|
|
42
|
+
|
|
43
|
+
# Find recent users (query/pipeline args are JSON)
|
|
44
|
+
c4ai run mongodb find app users '{"status":"active"}' 10
|
|
45
|
+
c4ai run mongodb aggregate app events '[{"$match":{"type":"signup"}},{"$limit":5}]'
|
|
46
|
+
```
|
package/c4ai.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cli4ai/mongodb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "MongoDB queries",
|
|
5
5
|
"author": "cliforai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@cli4ai/lib": "^1.0.0",
|
|
32
|
-
"commander": "^14.0.0"
|
|
32
|
+
"commander": "^14.0.0",
|
|
33
|
+
"mongodb": "^6.0.0"
|
|
33
34
|
},
|
|
34
35
|
"files": [
|
|
35
36
|
"run.ts",
|