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

Quotes in query params uuids #55

Open
rafaelrabeloit opened this issue Jul 18, 2016 · 1 comment
Open

Quotes in query params uuids #55

rafaelrabeloit opened this issue Jul 18, 2016 · 1 comment

Comments

@rafaelrabeloit
Copy link

I'm using Backbone in back and front end.
I configured Backbone-ORM + Backbone-HTTP in my "client" web app and used Backbone-ORM + Backbone-Mongo + Backbone-REST in my REST API.
It worked fine until I tested some queries using relationship keys from my client against the REST API.

Product.find({
  category_id: '5785228fc2ad8a23481dbb75'
}, function (err, products) {
  $("body").html(JSON.stringify(products));
});

The request that is made:
http://localhost:8080/products?category_id=%225785228fc2ad8a23481dbb75%22

That means that the category_id here is interpreted as number represented in string, and therefore must be "quoted".
But I don't think that is the expected result. Even more when the restify server, with the Backbone-REST on top of it, doesn't interpret it right and the GET returns [], even though the request without the quotes return it right.

@kmalakoff
Copy link
Member

Sorry to hear. A couple of ideas:

  1. Are you parsing the query parameters using middleware that calls JSONUtils.parseQuery(query)?

  2. Are the schema relationships set up correctly on the server-side to define category_id as a Mongo ObjectId?

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