you need change ' to " in address definition.
the correct one should be
var address = "@ds045147.mongolab.com:45147/mydatabasename";
it fixes your problem. Happy Hollidays!
On Friday, December 7, 2012 2:40:00 PM UTC-5, man12 wrote:
>
> I am in the process of learning node.js and using mongoose for Mongodb. I
> am following an example from a tutorial to connect to hosted mongodb. I am
> getting the error message: 'database names cannot contain the character '.'
> Here is my code:
>
> // .............................................................
> var mongoose = require('mongoose');
> var Schema = mongoose.Schema;
>
> module.exports.mongoose = mongoose;
> module.exports.Schema = Schema;
>
> // Connect to cloud database
> var username = "myusername";
> var password = "mypassword";
> var address = ' @ds045147.mongolab.com:45147/mydatabasename';
> connect();
>
> // Connect to mongo
> function connect() {
> var url = 'mongodb://' + username + ':' + password + address;
> mongoose.connect(url);
> }
>
> function disconnect() { mongoose.disconnect(); }
>
> //
> ...................................................................................
>
> Any suggestions on what I may be doing wrong? Thanks in advance for any
> help.
>
> MN
>
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en