LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mongoimport

imports data into MongoDB

TLDR

Import JSON file
$ mongoimport --db [dbname] --collection [coll] --file [data.json]
copy
Import CSV file
$ mongoimport --db [dbname] --collection [coll] --type csv --headerline --file [data.csv]
copy
Import with authentication
$ mongoimport -u [user] -p [pass] --db [dbname] --collection [coll] --file [data.json]
copy
Import from URI
$ mongoimport --uri "[mongodb://host/db]" --collection [coll] --file [data.json]
copy
Import with drop
$ mongoimport --db [dbname] --collection [coll] --drop --file [data.json]
copy
Import JSON array
$ mongoimport --db [dbname] --collection [coll] --jsonArray --file [array.json]
copy

SYNOPSIS

mongoimport [options] [file]

DESCRIPTION

mongoimport imports data into MongoDB. It supports JSON, CSV, and TSV formats.The tool bulk loads documents. Useful for data migration and seeding databases.

PARAMETERS

--db NAME

Database name.
--collection NAME
Collection name.
--file FILE
Input file path.
--type TYPE
File type (json, csv, tsv).
--headerline
Use first line as field names.
--drop
Drop collection before import.
--help
Display help information.

INSTALL

sudo apk add mongodb-tools
copy
nix profile install nixpkgs#mongodb-tools
copy

CAVEATS

Not for large datasets. Use mongorestore for BSON. May be slow on big imports.

HISTORY

mongoimport is part of MongoDB Database Tools, providing data import capabilities since MongoDB's early versions.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid