I came up with a more elegant way to automatically import ALL collections:
ls -1 *.json | sed 's/.json$//' | while read col; do
mongoimport -d db_name -c $col < $col.json;
done
I hope this is helpful.
More Related Contents:
- Mongoimport of JSON file
- Date query with ISODate in mongodb doesn’t seem to work
- Convert MongoDB BsonDocument to valid JSON in C#
- Dump Mongo Collection into JSON format
- Parsing JSON with Unix tools
- How to escape special characters in building a JSON string?
- Importing local json file using d3.json does not work
- JSON Invalid UTF-8 middle byte
- JSON Naming Convention (snake_case, camelCase or PascalCase) [closed]
- Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference
- Unix command-line JSON parser? [closed]
- Unmarshaling json in Go: required field?
- UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0x80 in position 3131: invalid start byte
- Downloading JSON with NSURLSession doesn’t return any data
- How to fetch data from local JSON file on react native?
- Standard way of referencing an object by identity (for, eg, circular references)?
- List of Language Codes in YAML or JSON? [closed]
- Which Perl module would you recommend for JSON manipulation?
- Encode/Decode Array of Types conforming to protocol with JSONEncoder
- How to exclude properties from Swift Codable?
- JSON Parsing in Swift 3
- How can I use JSON on the web page from a source with neither CORS nor JSONP? [closed]
- Grails JSONBuilder
- Handle JSON Object in XMLHttp response in Excel VBA Code
- Filter Array Using Checkboxes with AngularJS
- How can I do JSON serializer ignore navigation properties?
- JSON single value parsing
- Very large HTTP request vs many small requests
- Error handling using JSONDecoder in Swift
- How to extract all the keys in a JSON object with BigQuery