Browse files

populate()d -> populated

  • Loading branch information...
1 parent e2c1221 commit 5f60efa94349d211ab3bb5274a4eb5d082d5009f @niemyjski niemyjski committed with aheckmann Feb 8, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1
@@ -146,7 +146,15 @@ Or just do it all at once
var MyModel = mongoose.model('ModelName', mySchema);
-We can then instantiate it, and save it:
+**Important!** If you define your model in a separate file you will need to call require('mongoose') in your model.
+When require is called mongoose will use the default connection: 'mongoose.connection'. However, if you connected
+to mongo by calling `mongoose.createConnection`, then your model will not return any data when querying or saving as
+the default connection will not be set. You should always connect to your mongo instance by calling 'mongoose.connect' which will set the default connection ('mongoose.connection')
+unless you need multiple connections. Finally, update your model definitions using the default connection:
+var MyModel = mongoose.connection.model('ModelName', mySchema);
var instance = new MyModel();

0 comments on commit 5f60efa

Please sign in to comment.