Questions tagged [mongoexport]
253 questions
66
votes
8 answers
mongoexport aggregate export to a csv file
I want to save the result from an aggregation into a csv file.
Using the mongo cmd line tool I can do this to get the results I want:
db.compras.aggregate({ $group : { _id : "$data.proponente", total : { $sum : "$price" } }}
How would I translate…

Baconator507
- 1,747
- 2
- 12
- 20
27
votes
5 answers
Export database from MongoDb atlas to the local machine Monogo compass
I have remote database in Atlas with name of "test" and I want to download collection name image_table as a JSON file.
In mac terminal:
$ mongoexport –db test –collection image_table image.json
I got the error>
020-01-16T13:49:12.822+0100 error…

Farbod Aprin
- 990
- 1
- 10
- 20
16
votes
1 answer
Mongoexport using $gt and $lt constraints on a date range
I am trying to get the orders made for a certain day from my mongodb using the following mongoexport call:
mongoexport --db store --collection user_data --query…

Leah
- 175
- 1
- 1
- 6
15
votes
3 answers
Use mongoexport with a --query for ISODate
I have this query but i´m getting a syntax error: unexpected identifier
mongoexport --db ium --collection events \
--query 'db.events.find({'created_at' : {
$gte: ISODate("2016-03-01T00:00:00.001Z"),
$lte:…

Chanafot
- 736
- 4
- 22
- 46
15
votes
4 answers
MongoDB - can't get data exported with mongoexport due to auth failed
I have a Mongo DB database and I trying to export couple "records" from one of the collections present in this database. Here is the command I am trying to use and the error I am getting:
mongoexport --collection my_collection --out…

L.D
- 1,279
- 3
- 15
- 31
15
votes
2 answers
Mongodb export nested field
I have a MongoDB and I want to export to a .csv file.
document:
{
"id" : 28,
"organisation" : "Mickey Mouse company",
"country" : "US",
"contactpersons" : [{
"title" : "",
"typecontact" : "D",
"mobilenumber" : "757784854",
…

Steven Filipowicz
- 389
- 2
- 10
- 25
11
votes
3 answers
mongoexport error: Failed: Failed to parse + Unrecognized field 'snapshot
Goal:to migrate my local mongodb data to mongobd atlas cluster.
Try:
1. export local data as json.
2. import json to cluster.
OS: Linuxmint 19.1 Cinnamon
mongo --version
MongoDB shell version v4.0.10
mongod --version
db version v3.6.3
I also have a…

Annie
- 345
- 2
- 5
- 18
9
votes
2 answers
Export from mongodb with converted object id to string
I want to export from mongodb where objectId will be converted to string when exporting.
ObjectId("507c7f79bcf86cd7994f6c0e").toString()
This does not work with export command. I tried the following but that showing syntax error.
./mongoexport…

sovon
- 877
- 2
- 12
- 28
8
votes
1 answer
mongoexport --fields --csv will only output the first field when working with subdocuments
Working:
.\mongoexport.exe --db mydb --collection slideproof_user_event_date_count --csv --out
events.csv --fields '_id,first_day'
.\mongoexport.exe --db mydb --collection slideproof_user_event_date_count --out
events.json --fields…

Cilvic
- 3,417
- 2
- 33
- 57
8
votes
2 answers
mongoexport syntax error message
I'm working with mongodb 2.4.3 and I cannot get mongoexport to work. The error message I get with each command is:
"JavaScript execution failed: SyntaxError: Unexpected identifier"
At first I thought the problem was with my query parameters, which…

SCallan
- 681
- 9
- 26
7
votes
1 answer
Mongodb dump (filtering documents and fields)
I want to make a partial dump of a Mongodb database (partial as in, I need to filter some documents and some fields). Then, this dump will be imported onto another server.
I cannot use the mongodump utility, as it doesn't allow filtering fields.
I…

MikiTesi
- 181
- 1
- 2
- 7
7
votes
1 answer
How to export mlab online database to file
I've been given a database hosted on mlab. I'm trying to download the files off of the database and onto my computer. How may I go about that? I should add I have never worked with mlab or MongoDB before. All I want to do is download the files in…

user3767096
- 81
- 1
- 3
7
votes
1 answer
Get JSON file from mongodump
I'm trying to export one of my mongo collections using this command:
"C:\Program Files\MongoDB\Server\3.2\bin\mongodump" -h 127.0.0.1 --port 3001 -d meteor
I have a BSON file with my db collection but i want it in a JSON file.
How can I do it?

alpheonix
- 269
- 2
- 5
- 12
7
votes
2 answers
Mongoexport get property of nested objects in CSV output
I'm trying to get a CSV from mongo-db by using mongoexport.
My data is in this format:
{
"_id": "99",
"page_id": NumberLong(1122334455),
"data": {
"0": {
"item_id": NumberLong(123456789),
"item_name":…

finoutlook
- 2,523
- 5
- 29
- 43
6
votes
3 answers
mongoexport - issue with JSON query (extended JSON - Invalid JSON input)
I have started learning MongoDB recently. Today the instructor taught us the mongoexport command. While practicing the same, I face a typical issue which none of the other batchmates including the instructor faced. I use MongoDB version 4.2.0 on my…

itsraghz
- 857
- 1
- 11
- 25