Skip to content
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

suggestion: add mongooseModel parameter on resources.register #26

Closed
the-AjK opened this issue Jun 12, 2015 · 3 comments
Closed

suggestion: add mongooseModel parameter on resources.register #26

the-AjK opened this issue Jun 12, 2015 · 3 comments

Comments

@the-AjK
Copy link

the-AjK commented Jun 12, 2015

Hi,
It would be useful to be able set a different mongooseModel when registering a new resource rather than use the url parameter as the name of the mongoDB collection:

server.resources.register({
    url: '/libri',
    mongooseModel: '/books',
    model: {
        title: String,
        price: Number
    }
});
@the-AjK the-AjK changed the title suggestion: add mongooseModel params on resources.register suggestion: add mongooseModel parameter on resources.register Jun 12, 2015
@zackyang000
Copy link
Owner

Actually, the url param will ignore '/' char if your url contain it. So, if you want to mongooseModel is 'books', you can set url is '/books' or 'books'. it's the same.

I think keep url and resource name is a better way to practice, and I will let this module support more other DB. So, add mongooseModel param maybe isn't a good choose.

Thank you for your suggestion.

@the-AjK
Copy link
Author

the-AjK commented Jun 15, 2015

good choose to support more other DB, my point was to be able to set the url with a different string rather than use the resource name.

@zackyang000
Copy link
Owner

Right, maybe should add this optional param. Sometime, the resource name will different from url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants