[mongoose] Changing default port for connection

2,569 views
Skip to first unread message

dale tan

unread,
Jul 9, 2011, 4:02:35 PM7/9/11
to mongoo...@googlegroups.com
How can i change the default port for a db connection.  Right now it is going to 27017.
i tried

mongoose.connect('mongodb://localhost/test', 27020) 

but that doesn't seem to work.

thanks
dale

Tom

unread,
Jul 9, 2011, 4:33:39 PM7/9/11
to Mongoose Node.JS ORM
does
mongoose.connect('mongodb://localhost/test:27020')
work?

Matt Cobb

unread,
Jul 9, 2011, 7:29:37 PM7/9/11
to mongoo...@googlegroups.com
Read this:

--
MC

"...they reach for the future with creative hand, and everything that is or has been becomes for them a means, an instrument, a hammer." Nietzsche

dale tan

unread,
Jul 10, 2011, 11:14:41 AM7/10/11
to mongoo...@googlegroups.com
Thanks Matt.  That makes things clearer, though I'm having issues with my ports still, but i'll work on that.  At least I have a reference now.

Tom, it would be this: 
mongoose.connect('mongodb://localhost:27020/test')
--
-- 
CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it may contain confidential
information that is legally privileged and is intended for the designated
recipient only. If you have received it in error, please notify the sender
immediately and delete the original. Any other use of the email by you is
STRICTLY PROHIBITED.

Matt Cobb

unread,
Jul 11, 2011, 8:22:17 PM7/11/11
to mongoo...@googlegroups.com
Are you starting mongod with that port?  mongod --port 27020

dale tan

unread,
Jul 11, 2011, 11:26:43 PM7/11/11
to mongoo...@googlegroups.com
Matt, ya i did that.  I haven't looked into this issue, but I'll continue working on it when I can and then let you know where I ended up.

thanks
dale

dale tan

unread,
Jul 13, 2011, 9:57:21 AM7/13/11
to mongoo...@googlegroups.com
so this works 100%:
mongoose.connect('mongodb://localhost:27020/test')

Since i'm testing and all my files are complete messes right now, I must have not had the db url defined correctly throughout the different files (yes, should be in one file only). 

thanks for the help
Reply all
Reply to author
Forward
0 new messages