I am running a job which produces a json output file and I want to dump the file contents into mongo as a part of build step but when I run mongoimport the job fails saying mongoimport command not found
Below is the command am using as a part of build step shell script:
'''mongoimport --uri "dbString" --drop --collection col-name --file file-path-in-workspace -- jsonArray'''
Related
trying to import a csv file into my MongodbAtlas collection.
This is the command I run in terminal:
mongoimport --uri mongodb+srv://Jfreundlich01:<PASSWORD>#seir-cluster.sclij.mongodb.net/Optimizer --collection Players --type csv --file "Seed.csv"
Where Seed.csv is a file on my desktop.
When I click return it goes to a new line in my terminal but nothing happens.
After I run that line, if I type mongoimport --help or --version or any of those options, I get:
no such file or directory: <part of my password>#seir-cluster.sclij.mongodb.net/Optimizer
But if I close the terminal, open a new terminal and run mongoimport --version i get:
mongoimport version: 100.6.0
Any help/guidance would be greatly appreciated!
Thanks
Monngod db
We are creating database daily based on date like ERROR_LOG_12012016.
We now back up on a daily basis when I take dump its done all attached database for here we need to yesterday database only how to do that kindly help this
Regards,
Baskar r
I Think you are looking for this
mongodump --collection myCollection --db test
Based on your comment you should run the cron every day.
Try executing the command in shell script.MongoDump with timestamp
You can use mongoexport
mongoexport -d database_name -c collection_name -o output_file.json
To make it run automatically, follow the below steps
step1: write shell script, Your shell script will be as below,
#!/bin/bash
# My first script
mongoexport -d database_name -c collection_name -o output_file.json
step2: Save the file by name filename
step3: Try running file by command ./filename
step4: Add this command to crontab
I'm facing a problem in importing a CSV file to my db. I tried this command:
mongoimport --db meteor -h localhost:3001 -c TollPlaza -d meteor --headerline --type csv --file TollPlaza.csv
I referred to this question but am still having a problem.
Try this query :
mongoimport --db meteor --host localhost --port 3001 -c TollPlaza -d
meteor --headerline --type csv --file TollPlaza.csv
Maybe seperate host and port
The query is perfectly fine.
Follow the instructions
run the meteor project
Open a one more command prompt in same location
make sure that csv file present in the same directory.
run the query.
check the DB (show collections).
I'm trying to import a csv file into MongoDB and running into "Unexpected Identifier" error.
mongoimport –-db projectexperiment -—collection structured_1000 --type csv --file /dataset/structured/structured_1000.csv --headerline
Am quite new to MongoDB and was wondering if some one could point me in the right direction
You need to run mongoimport from the terminal. Assuming you are using Windows, you need to start a DOS prompt (cmd) go to the bin directory of your mongodb installation and run your monogimport command:
C:\mongodb\bin>mongoimport –-db projectexperiment -—collection structured_1000 --type csv --file /dataset/structured/structured_1000.csv --headerline
I have installed mongoDB2.4 installed in my windows 7 os. I am new to mongoDB. I would like to import data from a csv file into the database. I have used the mongoimport command but it shows:
Javascript execution failed: Syntax error: Unexpected identifier
my command in mongo shell was:
mongoimport --db mentalhealth --collection bidyut --type csv --file \Users\Adrian\Desktop\Data_sorted.csv
PLEASE kindly provide an answer.