import
Import command reference
Syntax
toollessdb import <database> <collection> <file>
--path <path> Path to database directory (default: ./data)
--drop Drop collection before importOptions
| Option | Description | Default |
|---|---|---|
--path <path> | Path to database directory | ./data |
--drop | Drop collection before import | - |
Arguments
| Argument | Description |
|---|---|
<database> | Database name |
<collection> | Collection name |
<file> | JSON file to import |
Examples
Import from a JSON file:
toollessdb import mydb users data.jsonDrop Collection
Use --drop to remove all existing documents before importing. This ensures a clean import.
Import with drop (replaces all documents):
toollessdb import mydb users data.json --dropImport from custom database path:
toollessdb import mydb users users.json --path /data/mydbImport NDJSON (newline-delimited JSON):
cat users.ndjson | toollessdb import mydb users -