[SERVER-17684] Allow invocation of JavaScript functions/closures from $project Created: 22/Mar/15 Updated: 16/May/15 Resolved: 15/May/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Alex Paransky | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
There are many functions which are not currently available in $project. For example, quite a few people are asking for string.indexOf("target") functionality, so that the result can be used in $substr command. Instead of adding each of the functions, simply allow invoking any JavaScript function in the process of creating a $project field. Also, it would be nice to write a closure and invoke it. This way multi-step operations could also be performed. |
| Comments |
| Comment by Asya Kamsky [ 16/May/15 ] | ||||||||||||
|
See | ||||||||||||
| Comment by Alex Paransky [ 15/May/15 ] | ||||||||||||
|
Are there any plans to add additional math functions and string functions, so that we don't have to do things like:
To try to approximate what the http://www.w3schools.com/jsref/jsref_round.asp normally does? | ||||||||||||
| Comment by Ian Whalen (Inactive) [ 15/May/15 ] | ||||||||||||
|
As a design decision we do not want the aggregation pipeline executing javascript. |