[SERVER-49722] Allow use db.system.js functions in $function Created: 19/Jul/20 Updated: 22/Sep/20 Resolved: 22/Sep/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Minor - P4 |
| Reporter: | Roman Cherepanov | Assignee: | Katya Kamenieva |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | qopt-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Query 2020-10-05 |
| Participants: |
| Description |
|
Are there any plans to allow the using db.system.js stored functions in $function? Like $where or Map-Reduce. I haven't found this feature in the 4.4.0-rc13 version
|
| Comments |
| Comment by Katya Kamenieva [ 22/Sep/20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
hi roman.cherepanov@gmail.com, thank you for the detailed description of your request. We are not planning on expanding the use of system.js for storing user-defined functions, as this approach doesn't work well in many cases. For example, in sharded clusters, javascript functions will have to be created on every shard. We will be looking for better alternatives to provide storing of the functions in the future, but currently this work is not scheduled. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 13/Sep/20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the steps roman.cherepanov@gmail.com and apologies for a delayed response. You are correct that when using mapReduce the use of function works but does not work when using this directly in $function. This is also in-line with the goals of this new functionality where we added support to allow loading system.js functions for $where and MapReduce, but do not support this behavior for UDFs. We're assigning this ticket to the appropriate team to be evaluated against our currently planned work. Thanks, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roman Cherepanov [ 19/Aug/20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here are all the steps where the error is reproduced:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 10/Aug/20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi roman.cherepanov@gmail.com, could you please provide all the steps you've used during this test so that we'll be able to reproduce this? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roman Cherepanov [ 03/Aug/20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Dmitry, I've stored my custom function using [Store a JavaScript Function on the Server|https://docs.mongodb.com/manual/tutorial/store-javascript-function-on-server/index.html] manual. But when I call this function in $function statement I've got ReferenceError. However, it works in mapReduce. Tested in 4.4.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dmitry Agranat [ 02/Aug/20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi roman.cherepanov@gmail.com, Here is the blog post that was published about the release and its key highlights. Additionally, here is the announcement that went out to the community. Regarding your request, does Store a JavaScript Function on the Server address your question? Thanks, |