mongoimport

Rails/Mongoid: Parent object not recognising child of has_many/belongs_to relation after mongoimport

丶灬走出姿态 提交于 2019-12-11 19:09:11
问题 A CSV containing the following rows is imported into mongodb via CSV using the mongoimport tool: object_1_id,field1,field2 52db7f026956b996a0000001,apples,oranges 52db7f026956b996a0000001,pears,plums The fields are imported into the collection Object2 . After import the rows are confirmed to exist via the console. #<Object2 _id: 52e0713417bcabcb4d09ad12, _type: nil, field1: "apples", field2: "oranges", object_1_id: "52db7f026956b996a0000001"> #<Object2 _id: 52e0713517bcabcb4d09ad76, _type:

How to define delimeter to import mongodb

≯℡__Kan透↙ 提交于 2019-12-10 09:45:04
问题 I have a data collection, which is separated by | character. I am going to add the data collection to mongodb . So I need to separate data through | character. how my mongoimport command looks like? Previously, I'm successfully import csv file through the following command. $ mongoimport -d mydb -c things --type csv --file locations.csv --headerline 回答1: mongoimport supports either JSON, CSV (comma separated values) or TSV (tab separated values). The | character is not a valid delimiter for

`fields cannot be identical: ' ' and ' '` mongoimport error

眉间皱痕 提交于 2019-12-10 01:21:44
问题 i'm trying to import a csv into mongodb on my local machine. I used the following commmand from the shell: mongoimport -d mydb -c things --type csv --file /Users/..../agentsFullOutput.csv --headerline I get the following error: Failed: fields cannot be identical: '' and '' I can't find anything on what that means. What am I doing wrong? The csv file, by the way, is the result of a mongoexport. here are the column headers and some data: _id build_profile company_address company_name company

Importing mongo collection into existing collection without overriding it

好久不见. 提交于 2019-12-08 08:24:35
问题 Is it possible to import a mongodump into a existing collection adding to it (not overriding it)? If yes, how? Would it be using mongoimport --db mydb ? The collections are the same in structure but simple have different datasets from different instances of the same app. I'd like to merge all data into a single database. 回答1: Use mongorestore. It is overwriting the collection only if you specify --drop parameter. So if you do nothing it will just add new element (thus doing what you want).

Import csv data as array in mongodb using mongoimport

拜拜、爱过 提交于 2019-12-06 07:34:54
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 suggest is there any another way to populate this "children" array directly from CSV?? To me, the simplest

mongoimport 2.6 vs 2.4

筅森魡賤 提交于 2019-12-06 04:06:29
问题 I am exporting data from one database and importing data to another database. When I export the data its on a machine with mongo 2.6 but when I import the data its on a VM using mongo 2.4. Both mongod instances are running 2.4. I keep getting this error: Wed Jun 4 13:13:32.604 check 0 0 Wed Jun 4 13:13:32.604 imported 0 objects Wed Jun 4 13:13:32.604 ERROR: encountered 1 error(s) failed: [192.168.140.30] => (item=collection) => {"changed": true, "cmd": "mongoimport -u username -p password -d

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

一笑奈何 提交于 2019-12-05 03:15: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 was the source code of mongoimport. So I guess it has something to do with the new version. Just a

`fields cannot be identical: ' ' and ' '` mongoimport error

牧云@^-^@ 提交于 2019-12-04 22:51:04
i'm trying to import a csv into mongodb on my local machine. I used the following commmand from the shell: mongoimport -d mydb -c things --type csv --file /Users/..../agentsFullOutput.csv --headerline I get the following error: Failed: fields cannot be identical: '' and '' I can't find anything on what that means. What am I doing wrong? The csv file, by the way, is the result of a mongoexport. here are the column headers and some data: _id build_profile company_address company_name company_website created_at device _token downloaded_app email first_name last_name is_proapp modified_at mobile

Convert to date MongoDB via mongoimport

余生颓废 提交于 2019-12-04 21:58:33
问题 I have downloaded huge chunks of data in the format in csv. I am using mongoimport to enter the data into MongoDB for processing. How do I get the date into date format recognized by MongoDB? sample data with header Date, Open Price, High Price, Low Price, Last Traded Price , Close Price, Total Traded Quantity, Turnover (in Lakhs) 04-Apr-2014,901,912,889.5,896.75,892.85,207149,1867.08 03-Apr-2014,908,918,897.65,900,900.75,156260,1419.9 02-Apr-2014,916,921.85,898,900.7,900.75,175990,1591.97

mongoimport 2.6 vs 2.4

戏子无情 提交于 2019-12-04 10:26:37
I am exporting data from one database and importing data to another database. When I export the data its on a machine with mongo 2.6 but when I import the data its on a VM using mongo 2.4. Both mongod instances are running 2.4. I keep getting this error: Wed Jun 4 13:13:32.604 check 0 0 Wed Jun 4 13:13:32.604 imported 0 objects Wed Jun 4 13:13:32.604 ERROR: encountered 1 error(s) failed: [192.168.140.30] => (item=collection) => {"changed": true, "cmd": "mongoimport -u username -p password -d db -c collection --drop --jsonArray /tmp/collection.json ", "delta": "0:00:00.026383", "end": "2014-06