mongoimport

mongodb-error validating settings: only one positional argument is allowed

本小妞迷上赌 提交于 2020-01-22 18:16:16
问题 I just moved to a new laptop which had mongo 3.0.0 I believe. On the new laptop I have mongo 3.0.4. and trying the script that was working on the old laptop is giving me errors. This line is giving me the error. mongoimport --host localhost \ -db roudy123_q \ -collection LebaneseAmericanUniversity\(Lebanon\).json \ --file LebaneseAmericanUniversity\(Lebanon\).json \ --jsonArray error validating settings: only one positional argument is allowed. I googled the error and the only relevant result

How to mongoexport and mongoimport collections with new ids but keeping the relation

落花浮王杯 提交于 2019-12-31 03:29:28
问题 I export 2 collections using mongoexport: mongoexport -h -u -p --db dev -c parent -q '{_id: ObjectId("5ae1b4b93b131f57b33b8d11")}' -o parent.json and mongoexport -h -u -p --db dev -c children -q '{parentId: ObjectId("5ae1b4b93b131f57b33b8d11")}' -o children.json From the first one I got one record (selected by ID) and from the second I got many record (selected by parentId which is ID from the first one. How can I use mongoimport to import those with new IDs but keeping the relation -> parent

How to use mongoimport to import csv

回眸只為那壹抹淺笑 提交于 2019-12-27 11:06:26
问题 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? 回答1: Your example worked for me with MongoDB 1.6

MongoDB- backing up and restoring users and roles

我是研究僧i 提交于 2019-12-24 08:07:40
问题 What are best practices for synching users and roles between Mongo instances? On the same Windows machine, I am trying to copy MongoDB users and roles in the admin database from one Mongo instance to another. Authentication is 'on' for each instance. No combination of mongodump\mongorestore or mongoexport\mongoimport I have tried works. With mongodump\restore, the restore step displays: assuming users in the dump directory are from <= 2.4 (auth version 1) Failed: the users and roles

importing CSV file MongoDB with ISODate

前提是你 提交于 2019-12-23 21:38:03
问题 When I export my data from mongoDB I obtain the following file: Everything is a string in the mongoDB except for the date that is ISODate. 123@123.com,sha1:64000:18:BTJnM903gIt5FNlSsZIRx1tLC9ErPJuB:9YVs800sgRPr1aaLj73qqnJ6,123,123,123@123.com,2017-04-28T09:20:07.480Z,cus_AYcVXIUf68nT52 If I import this file into MongoDB it import each value as String value. I need to parse the date as Date format, the rest can be string. I've seen that there's an argument for MongoImport --columnsHaveTypes. I

MongoDB Bulk import using mongoimport from Windows folder

自古美人都是妖i 提交于 2019-12-20 09:41:40
问题 I have a lot of json files in archive and i need to import them into mongo per one operation (i think that it might be in cycle). Have you any ideas about this? 回答1: If you are in a Linux/Unix shell you can try for filename in *; do mongoimport -d mydb -c $filename; done If you are on Windows: FOR %i IN (C:\mongodbData\*.json) DO mongoimport --db dbName --collection colection --type json --file %i 回答2: mongorestore is import all exported mongodb files cd C:\Program Files\MongoDB\Server\4.0

mongoimport Docker Failed: error connecting to the db server: no reachable servers

a 夏天 提交于 2019-12-14 02:25:46
问题 I am trying to create a Docker container with MongoDB and import data into it. I have tried using the following dockerfile: FROM mongo # This will be created if it doesn't exist WORKDIR /app/data/ # Copy dependency definitions COPY mydata.csv . ENTRYPOINT mongod # Import data RUN mongoimport --host=127.0.0.1 -d mydb -c reports --type csv --file mydata.csv --headerline I get the following error: Failed: error connecting to the db server: no reachable servers Any suggestions? Thanks! 回答1: Try

MONGODB Mongoimport possible speed up?

荒凉一梦 提交于 2019-12-12 18:53:05
问题 I have a 2 GB CSV file with 9 M records that I import into MongoDB using the native mongoimport tool. It imports the CSV at a rate of 8K per second. The overall time taken is 10 minutes. The speed of import is quite reasonable, but it seems to be much slower than the MySQL LOAD DATA INFILE version(takes only 2 minutes to insert all of the records into the database). While this is acceptable (MongoDB is built for JSON type objects and speed ups are generally in querying and not in inserting),

Import csv data as array in mongodb using mongoimport

感情迁移 提交于 2019-12-12 10:10:04
问题 I have been trying to import the csv data into mongodb using mongoimport. The collection is like this: { id:"122234343", name: "name1", children: ["222334444","333344444"] } One approach I tried is to create 2 csv files - one with id & name and other with id, children (if id has two children then it will have two rows). Import the data into two different collections using mongoimport and then use update the collection data using foreach() at second collection having children data. Please

Unable to import .csv into mongodb using mongoimport

混江龙づ霸主 提交于 2019-12-11 20:24:21
问题 I am doing some tests to see how I can import a simple .csv file into mongodb but it mongodb keeps returning "0 objects imported. Here are my steps: 1) create a simple .csv file named "a4.csv" in mongodb/bin with 4 columns and 6 records: Model Make Price Mileage audi a5 500 500 mercedes cla 333 434 ford fusion 555 500 mazda miata 222 434 nissan 370z 111 500 porsche cayenne 333 434 2) Run import command: ./mongoimport -d test -c cars --type csv --file a4.csv --headerline Output: tins-MBP:bin