ToollessToolless

import

Import command reference

Syntax

import.sh
toollessdb import <database> <collection> <file>
  --path <path>        Path to database directory (default: ./data)
  --drop               Drop collection before import

Options

OptionDescriptionDefault
--path <path>Path to database directory./data
--dropDrop collection before import-

Arguments

ArgumentDescription
<database>Database name
<collection>Collection name
<file>JSON file to import

Examples

Import from a JSON file:

import.sh
toollessdb import mydb users data.json

Drop Collection

Use --drop to remove all existing documents before importing. This ensures a clean import.

Import with drop (replaces all documents):

import.sh
toollessdb import mydb users data.json --drop

Import from custom database path:

import.sh
toollessdb import mydb users users.json --path /data/mydb

Import NDJSON (newline-delimited JSON):

import.sh
cat users.ndjson | toollessdb import mydb users -

On this page