Re: [mongoose] Use of mongoose.createConnection is confusing new users

3,786 views
Skip to first unread message

Aaron Heckmann

unread,
Aug 21, 2012, 4:45:51 PM8/21/12
to mongoo...@googlegroups.com
Thanks for the heads up.

I wanted to direct people to use createConnection b/c having two
methods leads to confusion (as we're still seeing) and I eventually
want to deprecate connect() since its sugar for createConnection
anyway. The docs should be consistently using this approach. Maybe
I'll add a section to the FAQ http://mongoosejs.com/docs/faq.html

On Tue, Aug 21, 2012 at 7:19 AM, JohnnyHK <john.ha...@gmail.com> wrote:
> Hey Aaron, there's been a number of recent questions on SO related to people
> using mongoose.createConnection instead of mongoose.connect. I think it's
> coming from the 3.0 documentation which uses this approach. The problem is
> that people start down this path and then fail when they use mongoose.model
> to register their schema (instead of db.model like in the examples). Is
> there a reason for the change in the getting started examples? Seems it
> would be better to direct newcomers to start with the mongoose.connect
> pattern instead.
>
> --
> --
> http://mongoosejs.com
> http://github.com/learnboost/mongoose
> You received this message because you are subscribed to the Google
> Groups "Mongoose Node.JS ORM" group.
> To post to this group, send email to mongoo...@googlegroups.com
> To unsubscribe from this group, send email to
> mongoose-orm...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/mongoose-orm?hl=en
>
>
>



--
Aaron
@aaronheckmann

JohnnyHK

unread,
Aug 21, 2012, 6:37:10 PM8/21/12
to mongoo...@googlegroups.com
Good to know that connect() may be deprecated at some point.  Is there still a concept of a 'default' connection without that?  That concept is very useful for easily defining models in separate files with just a require('mongoose') needed in each file to link everything together.


On Tuesday, August 21, 2012 3:45:51 PM UTC-5, Aaron Heckmann wrote:
Thanks for the heads up.

I wanted to direct people to use createConnection b/c having two
methods leads to confusion (as we're still seeing) and I eventually
want to deprecate connect() since its sugar for createConnection
anyway. The docs should be consistently using this approach. Maybe
I'll add a section to the FAQ http://mongoosejs.com/docs/faq.html

On Tue, Aug 21, 2012 at 7:19 AM, JohnnyHK <john.ha...@gmail.com> wrote:
> Hey Aaron, there's been a number of recent questions on SO related to people
> using mongoose.createConnection instead of mongoose.connect.  I think it's
> coming from the 3.0 documentation which uses this approach.  The problem is
> that people start down this path and then fail when they use mongoose.model
> to register their schema (instead of db.model like in the examples).  Is
> there a reason for the change in the getting started examples?  Seems it
> would be better to direct newcomers to start with the mongoose.connect
> pattern instead.




--
Aaron
@aaronheckmann

Aaron Heckmann

unread,
Aug 21, 2012, 7:19:28 PM8/21/12
to mongoo...@googlegroups.com
thats all way down the road. not sure what we'll do yet.

John Weis

unread,
Apr 1, 2013, 10:43:13 PM4/1/13
to mongoo...@googlegroups.com
Yep, banging my head too...  I don't think this is limited to beginners.  I've been doing node full-time at work 8+ months, although never used mongoose. So far, it's been really hard getting mongoose to do I what I think the documentation is saying it will do...

On Thursday, January 17, 2013 10:56:44 PM UTC-5, Avi Romanoff wrote:
+1 I am in literally the same boat as above... collection operation not returning because I switched from connect to createConnection when moving my models to separate module.

Even if the plan is to eventually deprecate connect(), I think it would be really beneficial if there was some explanation in the documentation that clearly outlined the differences between the two, and perhaps when one might want to use one or the other.

On Monday, November 26, 2012 3:24:28 PM UTC-5, David Erwin wrote:
+1 I also just spent too much time banging my head against this.  The documentation is not clear. 

On Tuesday, November 6, 2012 5:27:06 AM UTC-5, Lee Boynton wrote:
I'd like to +1 this. I've just spent a while getting frustrated at my save() call not working. The reason being I was using createConnection instead of connect to set the default connection.

robert...@gmail.com

unread,
Jul 10, 2013, 4:44:10 PM7/10/13
to mongoo...@googlegroups.com
Ok,

I am also lost.  I spent a great deal of time looking through the docs and finally found one that seemed to explain and show a full working example of createConnection vs connect.

How about this.  One day this week, someone who fully understands it, takes 15 minutes to explain it to me via skype.  I will then write out documentation for it from the perspective of someone who is new to Mongoose and does not make the same assumptions that the more versed among you would.

?

Just a thought.
best
Robert

Aaron Heckmann

unread,
Jul 10, 2013, 6:52:48 PM7/10/13
to mongoo...@googlegroups.com
Robert, email me and we'll set something up for tomorrow or Friday.




--
Documentation - http://mongoosejs.com/
Plugins - http://plugins.mongoosejs.com/
Bug Reports - http://github.com/learnboost/mongoose
Production Examples - http://mongoosejs.tumblr.com/
StackOverflow - http://stackoverflow.com/questions/tagged/mongoose
Google Groups - https://groups.google.com/forum/?fromgroups#!forum/mongoose-orm
Twitter - https://twitter.com/mongoosejs
IRC - #mongoosejs
---
You received this message because you are subscribed to the Google Groups "Mongoose Node.JS ODM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-orm...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Aaron


Chris Chang

unread,
Oct 9, 2013, 3:12:15 PM10/9/13
to mongoo...@googlegroups.com
Hi all,

Was this ever resolved?

-Chris
Reply all
Reply to author
Forward
0 new messages