Questions tagged [mongoexport]

227 questions
52
votes
7 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,577
  • 2
  • 11
  • 19
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
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
  • 9
  • 24
13
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,169
  • 3
  • 13
  • 28
10
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
  • 566
  • 1
  • 13
  • 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,277
  • 2
  • 28
  • 55
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
  • 612
  • 9
  • 22
7
votes
3 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
  • 432
  • 5
  • 11
7
votes
2 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
  • 229
  • 1
  • 4
  • 14
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
6
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
  • 229
  • 1
  • 5
  • 12
6
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,393
  • 5
  • 26
  • 42
6
votes
2 answers

Mongoexport error parsing query

Im trying to do a mongoexport to CSV but only selecting certain records with a query. Here's my command (windows 7 cmd): mongoexport --host foo.com --port 27017 --username bar -p --db foo --csv --fields col1,col2,col3 --collection bar --out…
joshlk
  • 1,190
  • 3
  • 17
  • 28
6
votes
1 answer

mongodb: extract timestamp from ObjectID in json query

I want to extract the timestamp from my ObjectID with a json query, as I would like to use mongodump but only dump data between certain dates. I dont wanna put my timestamps somewhere else than the ObjectID as I need the database to be as small as…
Rolle
  • 2,547
  • 5
  • 31
  • 37
5
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
  • 111
  • 1
  • 6
1
2 3
15 16