mongoexport

mongoexport returning scientific (exponential) notation

依然范特西╮ 提交于 2019-12-12 14:44:30
问题 So I was exporting some collections using mongoexport and found cases where large integers such as 9999999999999 were exported as 9.9999999999999e+13 So two questions: Why is this the case, and how can I prevent this? Thank you. 回答1: MongoDB treats all number literals as floating point by default, and above a certain threshold (32 bits?) it switches to scientific notation when exporting to JSON. 来源: https://stackoverflow.com/questions/37961380/mongoexport-returning-scientific-exponential

mongoexport reading a field with a space

风格不统一 提交于 2019-12-12 05:01:23
问题 I am trying to export a collection of 'contacts' from MongoDB into a CSV file. I am using MongoExport. My document looks as follows: { "id": 1, "name": [ { "FirstName": "joe", "LastName": "doe" } ] "address info": [ { "city": "London", "postcode": "N1 1AA" } ] } The command I am using is: mongoexport --username x --password x --host x --db mydb --collection mycol --type=csv --fields name.FirstName,name.LastName,Address Info.city,Address Info.postcode --out "c:\myfile.csv" The issue I am

MongoExport Too many positional options

点点圈 提交于 2019-12-12 04:37:31
问题 Am trying to run a mongoexport using a remote connection by filtering on date ranges. A very simple query, however, I am running into positional errors issue. I;ve read through most of the posts regarding it, did the epoch conversion etc. But completely hit a block. Hopefully someone here can figure out what I am doing wrong. Below is my command and the error message: C:\ mongoexport --host 1.1.1.111:1111 --db IQ -u user -p password --collection CallLog --out calllog.json --query '{"Call

MongoExport error - cannot unmarshal string

荒凉一梦 提交于 2019-12-12 01:36:28
问题 I have a MongoDB collection with the following documents. Some of the documents have 1 field and some have 2. I am interested in exporting only those that I have the field "productid". I am using the query below but getting the error: "cannot unmarshal string into GO value of type map[string] interface {}". The document looks like this: [ { "id" : 1, }, { "id" : 2, }, { "id" : 3 "Product Info": { "ProductName" : "test" } } ] The MognoExport command I am using is as follows: mongoexport -

query argument of mongoexport

断了今生、忘了曾经 提交于 2019-12-11 06:16:37
问题 What is the right format of query argument of mongoexport utility? While running the following command in the command line: mongoexport -h localhost:27000 -d dbName -c collName -q "{'time': { $gt: new Date('2014-01-28T12:00:00Z')}}" -o output.js I'm getting the following error: connected to: localhost:27000 assertion: 16619 code FailedToParse: FailedToParse: Expecting '}' or ',': offset:37 Reading Mongo Export query arg and JSONDocument docs haven't helped me to understand the expected format

Importing nested JSON documents into Elasticsearch and making them searchable

牧云@^-^@ 提交于 2019-12-08 12:04:27
问题 We have MongoDB-collection which we want to import to Elasticsearch (for now as a one-off effort). For this end, we have exported the collection with monogexport . It is a huge JSON file with entries like the following: { "RefData" : { "DebtInstrmAttrbts" : { "NmnlValPerUnit" : "2000", "IntrstRate" : { "Fxd" : "3.1415" }, "MtrtyDt" : "2020-01-01", "TtlIssdNmnlAmt" : "200000000", "DebtSnrty" : "SNDB" }, "TradgVnRltdAttrbts" : { "IssrReq" : "false", "Id" : "BMTF", "FrstTradDt" : "2019-04-01T12

How to mongoexport with one field

≯℡__Kan透↙ 提交于 2019-12-08 08:41:10
问题 i have a few fields in my collection at the mongoDB. i have tried exported out everything. which looking like this {"_id":{"$oid":"5a5ef05dbe83813f55141a51"},"comments_data":{"id":"211","comments":{"paging":{"cursors":{"after":"WzZANVFV4TlRVME5qUXpPUT09","before":"WTI5dEF4TlRVNE1USTVNemczTXpZAMk56YzZANVFV4TlRBMU9ERTFNQT09"}},"data":[{"created_time":"2018-01-04T09:29:09+0000","message":"Super","from":{"name":"M Mun","id":"1112"},"id":"1111"},{"created_time":"2018-01-07T22:25:08+0000","message"

How can I work with “join” to export data from MongoDB?

房东的猫 提交于 2019-12-07 18:14:15
问题 I have 2 collections: list1 and list2. list1 have some fields and list2 have another fields, including the id referring to list1. I need to do a query to export all items on list1 that have at least one item referring to him on list2. How can I do this? It's something like a join from list1 to list2. I need to run a mongoexport command to generate a csv file. 回答1: The way I do this is to create a short javascript program that will transfer the data you want to export into a new temporary

How to mongoexport with one field

不打扰是莪最后的温柔 提交于 2019-12-06 23:09:27
i have a few fields in my collection at the mongoDB. i have tried exported out everything. which looking like this {"_id":{"$oid":"5a5ef05dbe83813f55141a51"},"comments_data":{"id":"211","comments":{"paging":{"cursors":{"after":"WzZANVFV4TlRVME5qUXpPUT09","before":"WTI5dEF4TlRVNE1USTVNemczTXpZAMk56YzZANVFV4TlRBMU9ERTFNQT09"}},"data":[{"created_time":"2018-01-04T09:29:09+0000","message":"Super","from":{"name":"M Mun","id":"1112"},"id":"1111"},{"created_time":"2018-01-07T22:25:08+0000","message":"Happy bday..Godbless you...","from":{"name":"L1","id":"111"},"id":"1111"},{"created_time":"2018-01

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