-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List of all models #1362
Comments
That would break every app using mongoose. I find it odd that the application itself wouldn't know which models it created. |
Uhm, would it? In my app I use some homebrew |
Oh you're right, I misunderstood. Models are cached in different ways, for example, if calling |
Okay, so you would rather prefer a homebrew trycatch? function hasModel(namespace, name) {
try {
namespace.model(name);
} catch(e) {
return false;
}
return true;
}
console.log(hasModel(mongoose, "Model"));
console.log(hasModel(connection, "Model")); |
returns array of model names added. closes #1362
You convinced me. |
Kudos! |
|
oops, no. On Tue, Feb 26, 2013 at 3:28 PM, Jan Buschtöns notifications@git.luolix.topwrote:
Aaron |
returns array of model names added. closes #1362
Working with
mongoose.models
is meh. What aboutmongoose.model()
returning an array of all model names like:The text was updated successfully, but these errors were encountered: