I am trying to clone a remote mongo db to a local one. I am attempting to follow these instructions:
http://docs.mongodb.org/manual/reference/command/clone/
In the mongo console I type:
clone: "username#example.com:password#mymongohost.com:10035"
and the console comes back with:
username#example.com:password#mymongohost.com:10035
What am I doing wrong?
Thanks,
Kevin
Have you tried db.cloneDatabase("username#example.com:password#mymongohost.com:10035") or alternatively passing the {clone: "..."} as argument to db.runCommand()?
I think you're just missing how you're supposed to use those commands as the documentation isn't making it very clear. If you followed the 'copydb' link you might've spotted the example using 'db.copyDatabase()' instead and started wondering maybe there's a wrapper function for clone as well.
Related
So mongo was running fine, and then I tried to create a database and a collection. Long story short, the server stopped responding. I thought (after about 6 hours of trying everything else, asking my friends and getting literally nowhere) that maybe I should just uninstall and reinstall mongoDB. Turns out that was a mistake, because now when I try to do the mongo command I get this
$ mongo
bash: /c/Program Files/MongoDB/Server4.4/bin/mongo.exe: No such file or directory
I noticed that there is no "/" between Server and 4.4 --- I think that's the issue, but I have no idea how to fix that. An yes, I have added MongoDB to my system variable path...
What is going on here?
It seems like commands are working now. I guess I just needed to wait like 8 hours!?
I try to assigne a value to a variable in heroku.
heroku config:set NODE_ENV=production -> works fine.
But this does't work ->
heroku config:set DATABASE='mongodb+srv://Admin:#cluster0-vxluw.mongodb.net/test?retryWrites=true"&"w=majority'
I'm following a tutorial and in the tutorial it works with ' '.
I tried using " ", '', $() to wrap the string. Nothing works.
I get weird error:
The system can not find the stated file.
The command "w" is either misspelled or could not be found.
It seems that the ending of the link (&w=majority) causes the problem. That would explain the "w" in the error.
heroku config:set DATABASE="mongodb+srv://Admin:#cluster0-vxluw.mongodb.net/test?retryWrites=true&w=majority"
I hope it helps
I had experienced the same issue while trying to assign the MONGODB_URL to Heroku.
However removing the '&w=majority' at the end gave no errors and still worked.
The w=majority is for write concern, as described in the MongoDB docs. You can read more about it on MongoDB DOCS
I have spend days looking for answer to this relativ simple question. There are hundreds of questions like this and thousands of answers - but no one straigth and adequite. This tells me that the question may be rather "hot" and the answers maybe not that "hot".
I'm on a Windows environment, and for several reasons I want to be able to connect the projects I'm developing in Meteor to a local mongoDb, maybe an existing db - not the buildin one. Consequently I've 2 questions:
1.How du I use the local Mongo instead of the buildin on - adhoc, in developing a Meteor project ?
2. How do I set up a Meteor project to permanent use a speficic db on the local Mongo, also in developing state.>
After my desert journey with hard to understand and 'informed' answers and desperate solutions -like changing the local - adding scripts to json and adding Mongo_URL in terminal , please tell me what to write and where to write it.
Thanks
Below you will find the command for setting the MONGO_URL environment variable and running meteor at the same time. If you are unfamiliar with what environment variables are I would do a bit of searching on google so you understand what they are. You will need to update the databasename and port to match your local mongodb.
MONGO_URL=mongodb://localhost:27017/databasename meteor run
If you use npm, define “startLocal” in the scripts section of your package.json, e. g.
"startLocal": "ROOT_URL=http://localhost:3000 MAIL_URL=… MONGO_URL=mongodb://localhost:27017/databasename meteor run --port 3000 --settings settings.json"
Then run it using:
npm run startLocal
I am trying to create a new Strapi app on Ubuntu 16.4 using MongoDB. After stepping through the tutorial, here: https://strapi.io/documentation/3.0.0-beta.x/guides/databases.html#mongodb-installation, I get the following error: Connection test failed: spawn npm; ENOENT
The error seems obvious, but I'm having issues getting to the cause of it. I've installed latest version of MongoDB and have ensured it is running using service mongod status. I can also connect directly using nc, like below.
$ nc -zvv localhost 27017
Connection to localhost 27017 port [tcp/*] succeeded!
Here is an image of the terminal output:
Any help troubleshooting this would be appreciated! Does Strapi perhaps log setup errors somewhere, or is there a way to get verbose logging? Is it possible the connection error would be logged by MongoDB somewhere?
I was able to find the answer. The problem was with using npx instead of Yarn. Strapi documentation states that either should work, however, it is clear from my experience that there is a bug when using npx.
I switched to Yarn and the process proceeded as expected without error. Steps were otherwise exactly the same.
Update: There is also a typo in Strapi documentation for yarn. They include the word "new" before the project name, which will create a project called new and ignore the project name.
Strapi docs (incorrect):
yarn create strapi-app new my-project
Correct usage, based on my experience:
yarn create strapi-app my-project
The ENOENT error is "an abbreviation of Error NO ENTry (or Error NO ENTity), and can actually be used for more than files/directories."
Why does ENOENT mean "No such file or directory"?
Everything I've read on this points toward issues with environment variables and the process.env.PATH.
"NOTE: This error is almost always caused because the command does not exist, because the working directory does not exist, or from a windows-only bug."
How do I debug "Error: spawn ENOENT" on node.js?
If you take the function that Jiaji Zhou provides in the link above and paste it into the top of your config/functions/bootstrap.js file (above module.exports), it might give you a better idea of where the error is occurring, specifically it should tell you the command it ran. Then run the command > which nameOfCommand to see what file path it returns.
"miss-installed programs are the most common cause for a not found command. Refer to each command documentation if needed and install it." - laconbass (from the same link, below Jiaji Zhou's answer)
This is how I interpret all of the above and form a solution. Put that function in bootstrap.js, then take the command returned from the function and run > which nameOfCommand. Then in bootstrap.js (you can comment out the function), put console.log(process.env.PATH) which will return a string of all the directories your current environment is checking for executables. If the path returned from your which command isn't in your process.env.PATH, you can move the command into a path, or try re-installing.
Having some issues with maintaining too many SSH keys in the same computer lately.
I have created two SSH keys in my computer for UserA(Company) and UserB(Personal). Both the ID's are created using different email ID
I am able to pull and push the code changes for UserA
But UserB is where I face trouble to push my code.
I am able to pull the code for UserB(Where repo is different than UserA)
While pushing the code I get the following error
ERROR: Permission to UserB/xxxxxx.git denied to UserA.
Please make sure you have the correct access rights
and the repository exists. ```
Feel bit strange to me. Can someone help me this ?
Starting from Git 2.3.0 you can use below command
GIT_SSH_COMMAND='ssh -i private_key_file' git clone user#host:repo.git
Solved !!
Created Gitconfig for personal and work using the following link,
https://medium.com/#trionkidnapper/ssh-keys-with-multiple-github-accounts-c67db56f191e
Sometimes you have the problem of too many keys stored in the ssh-agent.
Then the server refuses the connection after it offering too many keys.
This can be solved by force ssh to use only one specific key.
GIT_SSH_COMMAND='ssh -o IdentityAgent=none -i private_key_file' git <cmd>