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

Multiple Select Params? #14

Open
brunocascio opened this issue Jun 16, 2014 · 2 comments
Open

Multiple Select Params? #14

brunocascio opened this issue Jun 16, 2014 · 2 comments

Comments

@brunocascio
Copy link

Hi !

Could I pass multiple select params?

example:

?select=title,author
@saintedlama
Copy link
Owner

You can use space separated fields

?select=title%20author

In case you prefer to use the , to separate fields you could use a really small middleware snippet to split the select parameter before passing the select parameter to restify-mongoose

function(req, res, next) {
  if (req.query.select) {
    req.query.select = req.query.select.split(',').join(' ')
  }

  next();
}

@ismarslomic
Copy link
Collaborator

@saintedlama should we add support for comma separated fields as it is more user friendly then applying white space?

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

3 participants