mongoimport

Mongoimport ignore leading zero in csv

假装没事ソ 提交于 2021-02-17 05:13:20
问题 I have a .CSV export file from a SQL Server database, with a phone number field (number type) that field values started with leading zero. Leading zero is presented in the CSV file. When I attempt to mongoimport it to DB (in string type) I find data imported without leading zero. The target field number is string. How can I solve this problem? 回答1: you can specifically define the type of the field using the import option --columnsHaveTypes Instructs mongoimport that the field list specified

Mongoimport ignore leading zero in csv

我们两清 提交于 2021-02-17 05:13:19
问题 I have a .CSV export file from a SQL Server database, with a phone number field (number type) that field values started with leading zero. Leading zero is presented in the CSV file. When I attempt to mongoimport it to DB (in string type) I find data imported without leading zero. The target field number is string. How can I solve this problem? 回答1: you can specifically define the type of the field using the import option --columnsHaveTypes Instructs mongoimport that the field list specified

Get result of Documents updated from mongoimport

蹲街弑〆低调 提交于 2021-01-29 19:59:00
问题 I'm upserting Documents into a Collection using mongoimport . I'm using shelljs to just run the actual mongoimport command the same way it'd be run through a CLI. E.g. mongoimport docs.json -d DB -c Collection --jsonArray --upsertFields=foo,bar This just outputs the # of Documents updated - but doesn't give any further details on what exactly was changed. However, I need to be able to see which documents were actually updated/inserted and then do something with these results. I would've

Cannot import json file into Mongo

痴心易碎 提交于 2020-06-16 00:36:11
问题 I have a JSON file (from Mongo University) with some JSON in it However, when I run the import: PS C:\Program Files\MongoDB\Server\3.0\bin> .\mongoimport.exe -d blog -c posts --drop posts.json I get an error and nothing is imported: 2016-04-15T22:21:27.771+0100 connected to: localhost 2016-04-15T22:21:27.772+0100 dropping: blog.posts 2016-04-15T22:21:28.635+0100 error inserting documents: lost connection to server 2016-04-15T22:21:28.635+0100 Failed: lost connection to server 2016-04-15T22:21

Cannot import json file into Mongo

孤街醉人 提交于 2020-06-16 00:35:07
问题 I have a JSON file (from Mongo University) with some JSON in it However, when I run the import: PS C:\Program Files\MongoDB\Server\3.0\bin> .\mongoimport.exe -d blog -c posts --drop posts.json I get an error and nothing is imported: 2016-04-15T22:21:27.771+0100 connected to: localhost 2016-04-15T22:21:27.772+0100 dropping: blog.posts 2016-04-15T22:21:28.635+0100 error inserting documents: lost connection to server 2016-04-15T22:21:28.635+0100 Failed: lost connection to server 2016-04-15T22:21

Importing a JSON file in an mongo container using authentication mechanism

前提是你 提交于 2020-05-16 06:18:10
问题 I am using a mongo container and want to insert the records in a JSON file to the mongo container Here is the docker-compose.yml version: '3' services: mongodb: image: mongo ports: - 27017:27017 environment: MONGO_INITDB_ROOT_USERNAME: "dev" MONGO_INITDB_ROOT_PASSWORD: "pass" mongo_seed: build: ./mongo-seed depends_on: - mongodb mongo-seed is another docker container which uses mongoimport to load the data in the database FROM mongo COPY services.json /services.json CMD mongoimport --host

How to import data into mongoDB

点点圈 提交于 2020-05-15 10:17:06
问题 I'm trying to import a large data file in JSON format . I'm using mongoimport --db verbs --collection de --file "/Users/marcelbraasch/Downloads/de.json" to import the data. This is going through, however, I'm getting the following exception: Failed: (Unauthorized) not authorized on verbs to execute command { insert: "de", ordered: false, writeConcern: { w: "majority" }, $db: "verbs" } I already tried combinations like this mongoimport -h localhost:27017 -u 'user' -p 'password' --db verbs -

error connecting to host: could not connect to server: server selection error: server selection timeout current topology: Type: Single Servers

时光总嘲笑我的痴心妄想 提交于 2020-02-25 06:04:21
问题 I need to import a CSV file to mongoDB unfortunately i'm having below error: error connecting to host: could not connect to server: server selection error: server selection timeout current topology: Type: Single Servers: Addr: eaderline:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : dial tcp: lookup eaderline: no such host my import string looks like that: mongoimport --host Test-shard-0/test-shard-00-00-gceee.mongodb.net:27017,test-shard-00-01-gceee

error connecting to host: could not connect to server: server selection error: server selection timeout current topology: Type: Single Servers

喜欢而已 提交于 2020-02-25 06:03:20
问题 I need to import a CSV file to mongoDB unfortunately i'm having below error: error connecting to host: could not connect to server: server selection error: server selection timeout current topology: Type: Single Servers: Addr: eaderline:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : dial tcp: lookup eaderline: no such host my import string looks like that: mongoimport --host Test-shard-0/test-shard-00-00-gceee.mongodb.net:27017,test-shard-00-01-gceee

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

╄→尐↘猪︶ㄣ 提交于 2020-01-22 18:17:25
问题 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