mongoimport

Import more than 1 json file using mongoimport

Deadly 提交于 2019-11-27 11:29:26
I am new to mongodb and want to know about importing a json file from one server to another. I tried the following command mongoimport -d test -c bik check.json and it works fine for me. Now i want to know when there are multiple json files how do i import all of them at a single go. I could not find any related document where it is written this is not possible. Please help me is this possible and how You can always write some shell scripts. colls=( mycoll1 mycoll2 mycoll5 ) for c in ${colls[@]} do mongoimport -d mydb -c $c.json done romaninsh I came up with a more elegant way to automatically

Importing Date-datatype using mongoimport

巧了我就是萌 提交于 2019-11-27 01:40:00
问题 I have many GB of data stored in PostgreSQL database and i need those to be imported into the MongoDB. I did this using CSV export and mongoimport. There are columns like this '2011-06-25' in that CSV and it has been imported as string, not as MongoDate, so i cannot effectively search by date. I've found this : http://www.mongodb.org/display/DOCS/Import+Export+Tools#ImportExportTools-Example%3AImportingInterestingTypes but the example says, i need to use JSON structure for the file. Do i

Import more than 1 json file using mongoimport

与世无争的帅哥 提交于 2019-11-26 15:36:07
问题 I am new to mongodb and want to know about importing a json file from one server to another. I tried the following command mongoimport -d test -c bik check.json and it works fine for me. Now i want to know when there are multiple json files how do i import all of them at a single go. I could not find any related document where it is written this is not possible. Please help me is this possible and how 回答1: You can always write some shell scripts. colls=( mycoll1 mycoll2 mycoll5 ) for c in $

How to use mongoimport to import csv

[亡魂溺海] 提交于 2019-11-26 14:48:41
Trying to import a CSV with contact information: Name,Address,City,State,ZIP Jane Doe,123 Main St,Whereverville,CA,90210 John Doe,555 Broadway Ave,New York,NY,10010 Running this doesn't seem to add any documents to the database: $ mongoimport -d mydb -c things --type csv --file locations.csv --headerline Trace says imported 1 objects , but firing up the Mongo shell and running db.things.find() doesn't show any new documents. What am I missing? Your example worked for me with MongoDB 1.6.3 and 1.7.3. Example below was for 1.7.3. Are you using an older version of MongoDB? $ cat > locations.csv