-
Notifications
You must be signed in to change notification settings - Fork 126
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
Inline javascript #1
Comments
Mongo only accepts javascript in special locations (it's not a general query expression). Specifically it only seems to be allowed in mapReduce which ecto does not support (yet?) and $where [1]. We could could pass it directly as the value the driver expects (possibly wrapped for ecto), for example: [1] http://docs.mongodb.org/manual/core/server-side-javascript/ |
It's possible to combine regular queries with javascipt [1]. It's basically possible to have a selector like this: [1] http://docs.mongodb.org/manual/reference/operator/query/where |
When talking to Eric, we thought we could make javascript a value. So we would do:
@ericmj ? |
I was thinking about making something like that, and providing all the functions like from q in Post, where: ^javascript("this.content.length < 100") |
@michalmuskala well, if it is a type, I wouldn't necessarily put in |
I tried implementing this to support the syntax I mentioned earlier, but I hit a problem with Ecto. From my understanding it seems that Ecto expects elements passed in where clause to be always convertible to boolean values. I see two solution for this: either modify Ecto to support passing other values to where, or make a new Ecto type to represent javascript that would respond to typecasting to a boolean, but return the |
fix update_all and insert_all tests
MongoDB gives possibility to query using javascript. It is somewhat similar to
fragment
. Is there a possibility to use custom functions in queries or only the predefined ones? Is the function apporoach good here? It would look something like this:The text was updated successfully, but these errors were encountered: