SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Dec 3, 2012, 15:24 #1
- Join Date
- Jun 2008
- Posts
- 27
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How do i Include the Mongoose Module?
Hi,
Im only on 'coming to a server near' you page 14.. i wondered how i included the mongDB files in the project?
I am on windows 7. writing my files in e-editor and have installed supervisor and everything has been going well.
but i am not sure where to put the mongo application files i downloaded from mongo.
i have attached my error.
Thanks for any help or a point in the right direction would be nice.
Do i have to just put the bin folder in the root of the app or???
-
Dec 3, 2012, 16:08 #2
- Join Date
- Jun 2008
- Posts
- 27
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I have re ran the npm install and it has included the Mongoose module.
when i run the app know i get an error saying
Database names cannot contain the character '.'
I have looked at all my code and it looks good and I am making the connection properly as i can see.
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
module.exports.mongoose = mongoose;
module.exports.Schema = Schema;
// Connect to cloud DB
var username = "firstProject"
var password = "Changed for safety!!";
var address = 'ds033257.mongolab.com:33257/firstproject';
connect();
// Connect to Mongo
// ================
function connect(){
var url = 'mongodb://'+ username + ':' + password + address;
mongoose.connect(url);
}
function disconnect() {mongoose.disconnect()}
it is complaining about drivers in the mongoose\lib\drivers\node-mongodb-native\connection
Do i need to put the drivers i downloaded from mongo any where in the project .. This is the bit i don't get , if i D/L some drivers or the download you need for windows? what do i do with them? or are they for if you don't want to built in the cloud and you install on your local machine?
any help or explanation would be good..
-
Dec 3, 2012, 18:19 #3
- Join Date
- Sep 2005
- Location
- Sydney, Australia
- Posts
- 776
- Mentioned
- 11 Post(s)
- Tagged
- 0 Thread(s)
If your actual password has spaces or @ symbols in it, try removing them and see if that helps
Next up, the address has to start with an "@" symbol
Code:var address = '@ds033257.mongolab.com:33257/firstproject';
var details = {
. . web: "afterlight.com.au",
. . photos: "jvdl.id.au",
. . psa: "usethelatestversion.com"
}
-
Dec 3, 2012, 18:55 #4
- Join Date
- Nov 2012
- Posts
- 48
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi trikkky, you don't have to put downloaded drivers in your project. Are you still having trouble after following AussieJohn's post?
-
Dec 4, 2012, 15:37 #5
- Join Date
- Jun 2008
- Posts
- 27
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
nodeError3.PNGYes I have installed ubuntu in a virtual box and going to try and do it from there as i have never done any terminal/cmd work in windows but have done lots in terminal and vim. so gonna see if it is windows .
here is my errors when i run app.js
i do not see a '.' anywhere and have deleted all inputs and typed them in again.
-
Dec 5, 2012, 03:08 #6
- Join Date
- Nov 2012
- Posts
- 48
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
OK let us know if Ubuntu makes any difference. One of the interesting thing is you can do is modify modules directly. In this case you could modify mongodb\lib\mongodb\db.js in a text editor to print out
databaseName
e.g. console.log(databaseName);
on line 210. If there is still a problem and you post the output, it might help shed further light on the problem
Bookmarks