How to connect to external MongoDB instance in Meteor?
I would like to find out how to connect to an external MongoDB instance in Meteor.
I have added this environment
Meteor.startup(function () {
process.env.MONGO_URL = 'mongodb://[UN]:PW]@[host]:[port]/meteorTest'
});
but still the data is coming from the local database.
I want to move all the collections from my local db to this external db. I read all the tutorials, its all telling me to setup this evn variable but nothing really working. How do I test whether its connected or not?
mongodb meteor
add a comment |
I would like to find out how to connect to an external MongoDB instance in Meteor.
I have added this environment
Meteor.startup(function () {
process.env.MONGO_URL = 'mongodb://[UN]:PW]@[host]:[port]/meteorTest'
});
but still the data is coming from the local database.
I want to move all the collections from my local db to this external db. I read all the tutorials, its all telling me to setup this evn variable but nothing really working. How do I test whether its connected or not?
mongodb meteor
link- Refer to the given link, hope you can find your answer
– Sampad
Aug 2 '16 at 6:26
i have already read this..but couldn't able to make out anything where i need to add the line of code ins the terminal or in the meteor startup? if i add this on startup it throw erros if i add this in terminal it shows export is not a command
– rahul cp
Aug 2 '16 at 6:34
try it in terminal
– Sampad
Aug 2 '16 at 6:46
i have set the variable in terminal, but when i am running meteor with that it throwing error 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 7:44
I've removed the urgent begging from this question, as it is likely to attract downvotes.
– halfer
Aug 2 '16 at 8:32
add a comment |
I would like to find out how to connect to an external MongoDB instance in Meteor.
I have added this environment
Meteor.startup(function () {
process.env.MONGO_URL = 'mongodb://[UN]:PW]@[host]:[port]/meteorTest'
});
but still the data is coming from the local database.
I want to move all the collections from my local db to this external db. I read all the tutorials, its all telling me to setup this evn variable but nothing really working. How do I test whether its connected or not?
mongodb meteor
I would like to find out how to connect to an external MongoDB instance in Meteor.
I have added this environment
Meteor.startup(function () {
process.env.MONGO_URL = 'mongodb://[UN]:PW]@[host]:[port]/meteorTest'
});
but still the data is coming from the local database.
I want to move all the collections from my local db to this external db. I read all the tutorials, its all telling me to setup this evn variable but nothing really working. How do I test whether its connected or not?
mongodb meteor
mongodb meteor
edited Aug 2 '16 at 7:15
halfer
14.5k758111
14.5k758111
asked Aug 2 '16 at 6:16
rahul cprahul cp
6027
6027
link- Refer to the given link, hope you can find your answer
– Sampad
Aug 2 '16 at 6:26
i have already read this..but couldn't able to make out anything where i need to add the line of code ins the terminal or in the meteor startup? if i add this on startup it throw erros if i add this in terminal it shows export is not a command
– rahul cp
Aug 2 '16 at 6:34
try it in terminal
– Sampad
Aug 2 '16 at 6:46
i have set the variable in terminal, but when i am running meteor with that it throwing error 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 7:44
I've removed the urgent begging from this question, as it is likely to attract downvotes.
– halfer
Aug 2 '16 at 8:32
add a comment |
link- Refer to the given link, hope you can find your answer
– Sampad
Aug 2 '16 at 6:26
i have already read this..but couldn't able to make out anything where i need to add the line of code ins the terminal or in the meteor startup? if i add this on startup it throw erros if i add this in terminal it shows export is not a command
– rahul cp
Aug 2 '16 at 6:34
try it in terminal
– Sampad
Aug 2 '16 at 6:46
i have set the variable in terminal, but when i am running meteor with that it throwing error 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 7:44
I've removed the urgent begging from this question, as it is likely to attract downvotes.
– halfer
Aug 2 '16 at 8:32
link- Refer to the given link, hope you can find your answer
– Sampad
Aug 2 '16 at 6:26
link- Refer to the given link, hope you can find your answer
– Sampad
Aug 2 '16 at 6:26
i have already read this..but couldn't able to make out anything where i need to add the line of code ins the terminal or in the meteor startup? if i add this on startup it throw erros if i add this in terminal it shows export is not a command
– rahul cp
Aug 2 '16 at 6:34
i have already read this..but couldn't able to make out anything where i need to add the line of code ins the terminal or in the meteor startup? if i add this on startup it throw erros if i add this in terminal it shows export is not a command
– rahul cp
Aug 2 '16 at 6:34
try it in terminal
– Sampad
Aug 2 '16 at 6:46
try it in terminal
– Sampad
Aug 2 '16 at 6:46
i have set the variable in terminal, but when i am running meteor with that it throwing error 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 7:44
i have set the variable in terminal, but when i am running meteor with that it throwing error 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 7:44
I've removed the urgent begging from this question, as it is likely to attract downvotes.
– halfer
Aug 2 '16 at 8:32
I've removed the urgent begging from this question, as it is likely to attract downvotes.
– halfer
Aug 2 '16 at 8:32
add a comment |
3 Answers
3
active
oldest
votes
In my own experience; I have needed to set the environment variable before starting the meteorjs server app. To do this you will need to pass the environment variable on the command-line as you invoke meteor or preset the environment for the profile that is running the meteor app on your system.
So you would start your app with this kind of a command:
MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor
You should also make sure that the mongodb is reachable and that your user credentials are correct! I am assuming you are trying to run meteor on your local machine using a remote mongodb instance.
On Windows
You will have to create a batch file in your meteor application folder to invoke the environment variable. There is an example of this here: https://stackoverflow.com/a/29833177/1997579
it throwing this error in the terminal 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 8:04
So you are on a windows machine? If so, please see this answer: stackoverflow.com/a/29833177/1997579
– Katalyst
Aug 2 '16 at 8:06
i created a .bat file with a name 'startup.bat' but still when i am running MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor it throwing the same error
– rahul cp
Aug 2 '16 at 9:03
You need to run the .bat file... not a command on the commandline and you need to make sure the mongodb url is configured correctly.
– Katalyst
Aug 2 '16 at 9:31
thank you so much for this idea..thumbs up
– rahul cp
Aug 2 '16 at 12:09
|
show 1 more comment
I don't like to use big repeating command and I was searching for a solution where I will be setting a variable embedded with something so every time I start my meteor app; the MONGO_URL will set to environment automatically. So this what I did:
In the package.json file I replaced the start parameter as below:
"scripts": {
"start": "MONGO_URL=mongodb://username:password@host_url:portnumber/dbname meteor run"
},
Now every time I want to run my app; I run npm start
instead of meteor
or meteor run
Note: there is a disadvantage with that. Your db credentials will be exposed if you put your db credentials to package.json file and add this file to version control.
add a comment |
run it in command prompt:
"MONGO_URL=mongodb://<USER>:<PASSWORD>@<SERVER>:<PORT>/<DB> meteor"
or
save this url in run.sh file in project folder and run meteor
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38713003%2fhow-to-connect-to-external-mongodb-instance-in-meteor%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
In my own experience; I have needed to set the environment variable before starting the meteorjs server app. To do this you will need to pass the environment variable on the command-line as you invoke meteor or preset the environment for the profile that is running the meteor app on your system.
So you would start your app with this kind of a command:
MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor
You should also make sure that the mongodb is reachable and that your user credentials are correct! I am assuming you are trying to run meteor on your local machine using a remote mongodb instance.
On Windows
You will have to create a batch file in your meteor application folder to invoke the environment variable. There is an example of this here: https://stackoverflow.com/a/29833177/1997579
it throwing this error in the terminal 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 8:04
So you are on a windows machine? If so, please see this answer: stackoverflow.com/a/29833177/1997579
– Katalyst
Aug 2 '16 at 8:06
i created a .bat file with a name 'startup.bat' but still when i am running MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor it throwing the same error
– rahul cp
Aug 2 '16 at 9:03
You need to run the .bat file... not a command on the commandline and you need to make sure the mongodb url is configured correctly.
– Katalyst
Aug 2 '16 at 9:31
thank you so much for this idea..thumbs up
– rahul cp
Aug 2 '16 at 12:09
|
show 1 more comment
In my own experience; I have needed to set the environment variable before starting the meteorjs server app. To do this you will need to pass the environment variable on the command-line as you invoke meteor or preset the environment for the profile that is running the meteor app on your system.
So you would start your app with this kind of a command:
MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor
You should also make sure that the mongodb is reachable and that your user credentials are correct! I am assuming you are trying to run meteor on your local machine using a remote mongodb instance.
On Windows
You will have to create a batch file in your meteor application folder to invoke the environment variable. There is an example of this here: https://stackoverflow.com/a/29833177/1997579
it throwing this error in the terminal 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 8:04
So you are on a windows machine? If so, please see this answer: stackoverflow.com/a/29833177/1997579
– Katalyst
Aug 2 '16 at 8:06
i created a .bat file with a name 'startup.bat' but still when i am running MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor it throwing the same error
– rahul cp
Aug 2 '16 at 9:03
You need to run the .bat file... not a command on the commandline and you need to make sure the mongodb url is configured correctly.
– Katalyst
Aug 2 '16 at 9:31
thank you so much for this idea..thumbs up
– rahul cp
Aug 2 '16 at 12:09
|
show 1 more comment
In my own experience; I have needed to set the environment variable before starting the meteorjs server app. To do this you will need to pass the environment variable on the command-line as you invoke meteor or preset the environment for the profile that is running the meteor app on your system.
So you would start your app with this kind of a command:
MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor
You should also make sure that the mongodb is reachable and that your user credentials are correct! I am assuming you are trying to run meteor on your local machine using a remote mongodb instance.
On Windows
You will have to create a batch file in your meteor application folder to invoke the environment variable. There is an example of this here: https://stackoverflow.com/a/29833177/1997579
In my own experience; I have needed to set the environment variable before starting the meteorjs server app. To do this you will need to pass the environment variable on the command-line as you invoke meteor or preset the environment for the profile that is running the meteor app on your system.
So you would start your app with this kind of a command:
MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor
You should also make sure that the mongodb is reachable and that your user credentials are correct! I am assuming you are trying to run meteor on your local machine using a remote mongodb instance.
On Windows
You will have to create a batch file in your meteor application folder to invoke the environment variable. There is an example of this here: https://stackoverflow.com/a/29833177/1997579
edited May 23 '17 at 10:31
Community♦
11
11
answered Aug 2 '16 at 7:25
KatalystKatalyst
406410
406410
it throwing this error in the terminal 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 8:04
So you are on a windows machine? If so, please see this answer: stackoverflow.com/a/29833177/1997579
– Katalyst
Aug 2 '16 at 8:06
i created a .bat file with a name 'startup.bat' but still when i am running MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor it throwing the same error
– rahul cp
Aug 2 '16 at 9:03
You need to run the .bat file... not a command on the commandline and you need to make sure the mongodb url is configured correctly.
– Katalyst
Aug 2 '16 at 9:31
thank you so much for this idea..thumbs up
– rahul cp
Aug 2 '16 at 12:09
|
show 1 more comment
it throwing this error in the terminal 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 8:04
So you are on a windows machine? If so, please see this answer: stackoverflow.com/a/29833177/1997579
– Katalyst
Aug 2 '16 at 8:06
i created a .bat file with a name 'startup.bat' but still when i am running MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor it throwing the same error
– rahul cp
Aug 2 '16 at 9:03
You need to run the .bat file... not a command on the commandline and you need to make sure the mongodb url is configured correctly.
– Katalyst
Aug 2 '16 at 9:31
thank you so much for this idea..thumbs up
– rahul cp
Aug 2 '16 at 12:09
it throwing this error in the terminal 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 8:04
it throwing this error in the terminal 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 8:04
So you are on a windows machine? If so, please see this answer: stackoverflow.com/a/29833177/1997579
– Katalyst
Aug 2 '16 at 8:06
So you are on a windows machine? If so, please see this answer: stackoverflow.com/a/29833177/1997579
– Katalyst
Aug 2 '16 at 8:06
i created a .bat file with a name 'startup.bat' but still when i am running MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor it throwing the same error
– rahul cp
Aug 2 '16 at 9:03
i created a .bat file with a name 'startup.bat' but still when i am running MONGO_URL='mongodb://user:password@remote.domain.com:12345/' meteor it throwing the same error
– rahul cp
Aug 2 '16 at 9:03
You need to run the .bat file... not a command on the commandline and you need to make sure the mongodb url is configured correctly.
– Katalyst
Aug 2 '16 at 9:31
You need to run the .bat file... not a command on the commandline and you need to make sure the mongodb url is configured correctly.
– Katalyst
Aug 2 '16 at 9:31
thank you so much for this idea..thumbs up
– rahul cp
Aug 2 '16 at 12:09
thank you so much for this idea..thumbs up
– rahul cp
Aug 2 '16 at 12:09
|
show 1 more comment
I don't like to use big repeating command and I was searching for a solution where I will be setting a variable embedded with something so every time I start my meteor app; the MONGO_URL will set to environment automatically. So this what I did:
In the package.json file I replaced the start parameter as below:
"scripts": {
"start": "MONGO_URL=mongodb://username:password@host_url:portnumber/dbname meteor run"
},
Now every time I want to run my app; I run npm start
instead of meteor
or meteor run
Note: there is a disadvantage with that. Your db credentials will be exposed if you put your db credentials to package.json file and add this file to version control.
add a comment |
I don't like to use big repeating command and I was searching for a solution where I will be setting a variable embedded with something so every time I start my meteor app; the MONGO_URL will set to environment automatically. So this what I did:
In the package.json file I replaced the start parameter as below:
"scripts": {
"start": "MONGO_URL=mongodb://username:password@host_url:portnumber/dbname meteor run"
},
Now every time I want to run my app; I run npm start
instead of meteor
or meteor run
Note: there is a disadvantage with that. Your db credentials will be exposed if you put your db credentials to package.json file and add this file to version control.
add a comment |
I don't like to use big repeating command and I was searching for a solution where I will be setting a variable embedded with something so every time I start my meteor app; the MONGO_URL will set to environment automatically. So this what I did:
In the package.json file I replaced the start parameter as below:
"scripts": {
"start": "MONGO_URL=mongodb://username:password@host_url:portnumber/dbname meteor run"
},
Now every time I want to run my app; I run npm start
instead of meteor
or meteor run
Note: there is a disadvantage with that. Your db credentials will be exposed if you put your db credentials to package.json file and add this file to version control.
I don't like to use big repeating command and I was searching for a solution where I will be setting a variable embedded with something so every time I start my meteor app; the MONGO_URL will set to environment automatically. So this what I did:
In the package.json file I replaced the start parameter as below:
"scripts": {
"start": "MONGO_URL=mongodb://username:password@host_url:portnumber/dbname meteor run"
},
Now every time I want to run my app; I run npm start
instead of meteor
or meteor run
Note: there is a disadvantage with that. Your db credentials will be exposed if you put your db credentials to package.json file and add this file to version control.
edited Dec 12 '17 at 2:19
answered Dec 12 '17 at 1:59
AbdulAbdul
310312
310312
add a comment |
add a comment |
run it in command prompt:
"MONGO_URL=mongodb://<USER>:<PASSWORD>@<SERVER>:<PORT>/<DB> meteor"
or
save this url in run.sh file in project folder and run meteor
add a comment |
run it in command prompt:
"MONGO_URL=mongodb://<USER>:<PASSWORD>@<SERVER>:<PORT>/<DB> meteor"
or
save this url in run.sh file in project folder and run meteor
add a comment |
run it in command prompt:
"MONGO_URL=mongodb://<USER>:<PASSWORD>@<SERVER>:<PORT>/<DB> meteor"
or
save this url in run.sh file in project folder and run meteor
run it in command prompt:
"MONGO_URL=mongodb://<USER>:<PASSWORD>@<SERVER>:<PORT>/<DB> meteor"
or
save this url in run.sh file in project folder and run meteor
answered Aug 2 '16 at 11:55
sravanthisravanthi
21616
21616
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38713003%2fhow-to-connect-to-external-mongodb-instance-in-meteor%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
link- Refer to the given link, hope you can find your answer
– Sampad
Aug 2 '16 at 6:26
i have already read this..but couldn't able to make out anything where i need to add the line of code ins the terminal or in the meteor startup? if i add this on startup it throw erros if i add this in terminal it shows export is not a command
– rahul cp
Aug 2 '16 at 6:34
try it in terminal
– Sampad
Aug 2 '16 at 6:46
i have set the variable in terminal, but when i am running meteor with that it throwing error 'MONGO_URL' is not recognized as an internal or external command, operable program or batch file.
– rahul cp
Aug 2 '16 at 7:44
I've removed the urgent begging from this question, as it is likely to attract downvotes.
– halfer
Aug 2 '16 at 8:32