<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:54:10 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-458] JavaScript $function in update</title>
                <link>https://jira.mongodb.org/browse/SERVER-458</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;For maximum flexibility we should allow running arbitrary javascript code on each object during an update. It should probably run after other modifiers.&lt;/p&gt;

&lt;p&gt;update({_id: &quot;foo&quot;}. {$inc: &lt;/p&gt;
{count: 1, total: 5}
&lt;p&gt;, $function: function()&lt;/p&gt;
{this.avg = this.total / this.count}
&lt;p&gt;}&lt;/p&gt;</description>
                <environment></environment>
        <key id="10945">SERVER-458</key>
            <summary>JavaScript $function in update</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="12300">Won&apos;t Do</resolution>
                                        <assignee username="backlog-server-query">Backlog - Query Team</assignee>
                                    <reporter username="mathias@mongodb.com">Mathias Stearn</reporter>
                        <labels>
                            <label>js-in-agg</label>
                            <label>udf</label>
                    </labels>
                <created>Fri, 4 Dec 2009 13:16:53 +0000</created>
                <updated>Tue, 6 Dec 2022 05:51:13 +0000</updated>
                            <resolved>Sat, 29 Jun 2019 07:10:50 +0000</resolved>
                                                                    <component>Write Ops</component>
                                        <votes>157</votes>
                                    <watches>111</watches>
                                                                                                                <comments>
                            <comment id="2305616" author="asya" created="Sat, 29 Jun 2019 07:10:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-40381&quot; title=&quot;Add the ability to specify a pipeline to an update command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-40381&quot;&gt;&lt;del&gt;SERVER-40381&lt;/del&gt;&lt;/a&gt; implemented support for aggregation expressions to specify update.&#160; You can see some examples &lt;a href=&quot;https://docs.mongodb.com/master/reference/command/update/index.html#update-command-example-agg&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I&apos;m closing this ticket.&#160; Most use cases mentioned can be handled in aggregation using already existing expressions.&#160; In the future we will probably add ability to specify something more customized (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-9336&quot; title=&quot;Custom operators as a plug-in into aggregation framework&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-9336&quot;&gt;&lt;del&gt;SERVER-9336&lt;/del&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2003923" author="zhouao" created="Sat, 15 Sep 2018 08:31:45 +0000"  >&lt;p&gt;&#36825;&#20010;&#29305;&#24615;&#24456;&#22909;&#65292;&#24076;&#26395;&#33021;&#25903;&#25345;&lt;/p&gt;</comment>
                            <comment id="1828188" author="trumpetinc" created="Thu, 8 Mar 2018 23:38:06 +0000"  >&lt;p&gt;Having this ability, inside just the collection in question, would be a huge benefit.  Even if it only allowed operations inside the object that is being updated, it would add significant value.  Having to perform client-side iteration to do any sort of complex update is a big issue.&lt;/p&gt;</comment>
                            <comment id="1450359" author="asya" created="Tue, 6 Dec 2016 16:50:10 +0000"  >&lt;p&gt;For returning just keys, please look at and vote up &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-18794&quot; title=&quot;Add an aggregation expression to convert an object to an array of key, value pairs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-18794&quot;&gt;&lt;del&gt;SERVER-18794&lt;/del&gt;&lt;/a&gt; - that should allow returning just keys, or some subset of information using aggregate rather than find.&lt;/p&gt;</comment>
                            <comment id="1216217" author="ehremo" created="Sun, 27 Mar 2016 09:30:18 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-10213&quot; title=&quot;Allow eval() against a SINGLE document in a sharded collection (A.K.A findAndEval)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-10213&quot;&gt;&lt;del&gt;SERVER-10213&lt;/del&gt;&lt;/a&gt; is not necessarily a duplicate of this feature, if the function is interpreted as the projection.&lt;br/&gt;
My use case is that have some large documents, and I would like my queries to only return a subset of the information. For example if I wanted only the keys I&apos;d like to be able to do this&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.collection.find(&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    {...},&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    function(d) {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        return Object.keys(d);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;This is particularly important when the query is being made from another process to avoid sending back lots of unnecessary data.&lt;/p&gt;</comment>
                            <comment id="421192" author="ahildoer" created="Mon, 9 Sep 2013 20:24:27 +0000"  >&lt;p&gt;I have to backup Oleg&apos;s response to Kevin regarding relational database like functionality. &lt;/p&gt;

&lt;p&gt;MongoDB&apos;s lack of relational database functionality is a technical decision, not political one against SQL. NoSQL purists don&apos;t avoid foreign key constraints (and multi-record atomic operations) just for the sake of being as NoSQL as possible. It is a fundamental shift which achieves performance and horizontal scalability that SQL solutions will never achieve without sacrificing vertical scale. &lt;/p&gt;

&lt;p&gt;My vote is -10000 for allowing IO in the $function method. Talking about foreign key enforcement/checking/whatever should be done within the context of the application, not the database server.&lt;/p&gt;</comment>
                            <comment id="421011" author="oleg@evergage.com" created="Mon, 9 Sep 2013 17:00:58 +0000"  >&lt;p&gt;Updates only apply to one collection, so you cannot access another collection anyway. There are no joins in MongoDB, so this is definitely out of scope.&lt;/p&gt;

&lt;p&gt;The Javascript function should only be updating one record at a time--not only is it a simpler implementation, but it is also cleaner conceptually. It allows the update to continue to be sharded and executed concurrently across shards. &lt;/p&gt;

&lt;p&gt;The new V8 engine in 2.4 restricts the ability to run database commands or access other data. See version 2.4 note here: &lt;a href=&quot;http://docs.mongodb.org/manual/reference/operator/where/#op._S_where&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/reference/operator/where/#op._S_where&lt;/a&gt; . FOr example &quot;db&quot; is not accessible. Therefore, there are already single-record access restrictions built-in.&lt;/p&gt;</comment>
                            <comment id="420976" author="justanyone" created="Mon, 9 Sep 2013 16:12:25 +0000"  >&lt;p&gt;Moshe Simatov makes a valid point about access control.  Certainly having a query that accesses other collections would require some security consideration.&lt;/p&gt;

&lt;p&gt;Perhaps, then, we split this case into:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Do no other record accesses (this case)&lt;/li&gt;
	&lt;li&gt;Access other records, assuring proper access control is granted.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I&apos;m thinking of a use case where we&apos;re verify validity of a foreign key.  TableOne: &lt;/p&gt;
{ ..., &apos;t2fk1&apos; : 12, ...}
&lt;p&gt;, TableTwo: &lt;/p&gt;
{ ..., &apos;fk1&apos; : 12, ...}
&lt;p&gt;, etc.&lt;/p&gt;

&lt;p&gt;This would replicate the SQL query:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;select t1.id, t1.fk1 from t1 where t1.fk1 not in (select t2.id from t2);&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;RECOGNIZED OBJECTIONS:  okay, so people will complain this isn&apos;t supposed to be a relational database, so we shouldn&apos;t have foreign keys.  But, sometimes this is unavoidable for application-specific reasons.  I need to be able to verify my foreign keys are valid.&lt;/p&gt;</comment>
                            <comment id="420395" author="ms" created="Sun, 8 Sep 2013 15:17:57 +0000"  >&lt;p&gt;Please consider security issues.&lt;br/&gt;
This function should update only the current document and can&apos;t access any other documents or collections.&lt;/p&gt;</comment>
                            <comment id="391891" author="ahildoer" created="Tue, 30 Jul 2013 15:38:49 +0000"  >&lt;p&gt;+1 Oleg. This is a a great start. Not knowing much of how things are abstracted internally in Mongo, would this also work for findAndModify? If so, this covers our use case entirely. &lt;/p&gt;

&lt;p&gt;As for the requirement that the driver support a BSON encoded function, instead of a string. This is an alternative notation that may work for backwards compatibility with drivers that don&apos;t support that. Using your example, this alternative syntax would be:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;update({}, { $set: { computed: { $func: &quot;return {value: this.a * this.b / this.c}&quot; } } }, { upsert: false, multi: true } );&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;(Please pardon the edits, I just found the &quot;preview&quot; button)&lt;/p&gt;</comment>
                            <comment id="391871" author="oleg@evergage.com" created="Tue, 30 Jul 2013 15:15:54 +0000"  >&lt;p&gt;We have implemented a partial solution of this as a $set that takes a JS function, e.g:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;update({}, { $set: { computed: function(){ return {value: this.a * this.b / this.c }} }}, { upsert: false, multi: true});&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/astral303/mongo/tree/javascript_update&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/astral303/mongo/tree/javascript_update&lt;/a&gt; (against 2.4.5).&lt;/p&gt;

&lt;p&gt;I opened up a discussion on mongodb-dev, it has more details: &lt;a href=&quot;https://groups.google.com/forum/#!topic/mongodb-dev/xttIIY1kt9k&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/#!topic/mongodb-dev/xttIIY1kt9k&lt;/a&gt; . In short, the syntax is not nailed down, but I&apos;m putting a feeler out for interest. Any feedback welcome!&lt;/p&gt;</comment>
                            <comment id="381440" author="ahildoer" created="Mon, 15 Jul 2013 17:38:16 +0000"  >&lt;p&gt;Just adding my vote for this $function supporting JavaScript. Need turing complete language out of the gate on this feature. I seriously doubt that would happen with any aggregation framework using things like $add, $divide, $average, etc.&lt;/p&gt;

&lt;p&gt;+1 for SlugFiller&apos;s suggestion of the syntax of $func: { $code: function(....&lt;/p&gt;</comment>
                            <comment id="317757" author="diversario" created="Sat, 20 Apr 2013 18:52:28 +0000"  >&lt;p&gt;Would LOVE to this this. I&apos;m writing a data migration script and this is exactly what I need. For now I&apos;ll have to write a lame .next()/.update() loop to go over a set.&lt;/p&gt;</comment>
                            <comment id="239584" author="rubytuesdaydono" created="Mon, 14 Jan 2013 19:08:42 +0000"  >&lt;p&gt;@&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=apiggott%40ikanow.com&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;Alex&lt;/a&gt;, is that &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3253&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-3253&lt;/a&gt;?&lt;/p&gt;</comment>
                            <comment id="153270" author="apiggott@ikanow.com" created="Tue, 14 Aug 2012 15:43:41 +0000"  >&lt;p&gt;+1 for any of these ideas! I linked this discussion in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-325&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-325&lt;/a&gt;, the issue for implementing &quot;$out&quot; in the aggregation framework.&lt;/p&gt;</comment>
                            <comment id="130819" author="slugfiller" created="Tue, 12 Jun 2012 06:58:01 +0000"  >&lt;p&gt;As I&apos;ve suggested in the thread here:&lt;br/&gt;
&lt;a href=&quot;https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/AFhzlDMPfKY&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/AFhzlDMPfKY&lt;/a&gt;&lt;br/&gt;
I would like to suggest a simpler solution that wouldn&apos;t require any database-breaking changes, but add a great deal of flexibility.&lt;/p&gt;

&lt;p&gt;The syntax, which is based on the &quot;group&quot; and &quot;mapReduce&quot; operations is this:&lt;br/&gt;
db.mycoll.update(&lt;/p&gt;
{mykey: &quot;key_value&quot;}
&lt;p&gt;, {$func: {code: function(obj) &lt;/p&gt;
{/* Manipulate object */ return obj; }, scope: {myglobal: &quot;global_value&quot;}};&lt;br/&gt;
&lt;br/&gt;
Similar syntax would be possible for &quot;findAndModify&quot;. In languages without code-gen capabilities, &quot;$func.code&quot; would be a string containing the JavaScript code, or whatever appropriate method is used to pass functions into &quot;group&quot; or &quot;mapReduce&quot; (e.g. MongoCode class in PHP).&lt;br/&gt;
The &quot;scope&quot; parameter is used for injection-safe constant addition, similar to the &quot;scope&quot; parameter in &quot;mapReduce&quot;. Drivers which support it may also allow specifying &quot;code&quot; and &quot;scope&quot; using a single driver-specific object for a function with a scope, e.g.:&lt;br/&gt;
array(&apos;$func&apos; =&amp;gt; new MongoCode(&apos;function(obj) {/* Manipulate object */ return obj; }
&lt;p&gt;&apos;, array(&apos;myglobal&apos; =&amp;gt; &apos;global_value&apos;)))&lt;/p&gt;

&lt;p&gt;This would be an atomic equivalent to (Removing the use of &quot;scope&quot; for brevity):&lt;br/&gt;
var obj = db.mycoll.findOne(&lt;/p&gt;
{mykey: &quot;key_value&quot;}
&lt;p&gt;);&lt;br/&gt;
if (obj == null &amp;amp;&amp;amp; !upsert) return;&lt;br/&gt;
var newobj = code(obj);&lt;br/&gt;
if (obj == null)&lt;br/&gt;
{&lt;br/&gt;
  if (newobj != null)&lt;br/&gt;
    db.mycoll.insert(newobj);&lt;br/&gt;
}&lt;br/&gt;
else&lt;br/&gt;
{&lt;br/&gt;
  if (newobj != null)&lt;br/&gt;
    db.mycoll.update({_id: obj._id}, newobj);&lt;br/&gt;
  else&lt;br/&gt;
    db.mycoll.remove();&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Notice from above that &quot;upsert&quot; is supported, in which case &quot;null&quot; is passed to the function. The function may return a different object from the one passed, and may also return &quot;null&quot; to perform a remove operation.&lt;/p&gt;

&lt;p&gt;The operation should have similar atomic properties as &quot;$inc&quot;. In fact, it should be to &quot;$inc&quot; what &quot;$where&quot; is to &quot;$gt&quot; - a generalization (Except, unlike &quot;$where&quot;, it doesn&apos;t carry an optimization penalty).&lt;br/&gt;
For this to be possible, however, the function may not call any database operations (contrary to some comments above), since the document must be locked while the function is running.&lt;br/&gt;
This is more useful than the alternative (Allow functions, but no atomic guarantees), since said alternative can easily be done using client-side code (&quot;find&quot;, processing, and &quot;update&quot;). An atomic non-trivial update operation is currently not possible without using some simulated locking mechanism, making it far more useful as an additional operation.&lt;/p&gt;

&lt;p&gt;And finally, here&apos;s a use-case example which cannot be done AT ALL using current methods:&lt;br/&gt;
var newvalue = db.mycoll.findAndModify({&lt;br/&gt;
  query: &lt;/p&gt;
{key:&quot;mykey&quot;}
&lt;p&gt;,&lt;br/&gt;
  update: {$func: {code: function(doc) { &lt;br/&gt;
    if (doc == null) return &lt;/p&gt;
{key:&quot;mykey&quot;, value: 1}
&lt;p&gt;;&lt;br/&gt;
    doc.value += ((doc.value % 5) == 4)?2:1; &lt;br/&gt;
    return doc; &lt;br/&gt;
  }}},&lt;br/&gt;
  new: true,&lt;br/&gt;
  upsert: true&lt;br/&gt;
}); &lt;/p&gt;

&lt;p&gt;The above implements an auto-increment value that &quot;skips&quot; any values which evenly divide by 5. (In other words, it returns &quot;1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16...&quot;)&lt;br/&gt;
Note that it is as atomic as an auto-increment value implemented using &quot;$inc&quot;, but with the added functionality that is not possible with &quot;$inc&quot;.&lt;/p&gt;</comment>
                            <comment id="125520" author="tamasnagy" created="Sun, 3 Jun 2012 19:00:18 +0000"  >&lt;p&gt;This would be extremely useful for updating statistics that shouldn&apos;t have to be calculated on the fly with either the aggregation framework or map/reduce. As mentioned above, along with &lt;tt&gt;this&lt;/tt&gt;, some type of context or passable parameters would be nice. This would be extremely useful if combined with the speed and flexibility of the aggregation framework expressions as mentioned by Colin.&lt;/p&gt;</comment>
                            <comment id="110353" author="sim" created="Mon, 16 Apr 2012 18:39:13 +0000"  >&lt;p&gt;Just wanted to add a +1 to specifying functions for update operations. I needed to build utilities in both JS and Ruby for this. &lt;/p&gt;

&lt;p&gt;In addition to &lt;tt&gt;this&lt;/tt&gt;, which provides access to the document, to make this work well for a broad range of uses without resorting to function codegen, the function should take an optional &lt;tt&gt;context&lt;/tt&gt; argument that can be passed as part of the query. &lt;/p&gt;</comment>
                            <comment id="88450" author="colinmollenhour" created="Tue, 14 Feb 2012 23:28:21 +0000"  >&lt;p&gt;The aggregation framework introduced lots of nice non-JS operators (&lt;a href=&quot;http://www.mongodb.org/display/DOCS/Aggregation+Framework+-+Expression+Reference&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Aggregation+Framework+-+Expression+Reference&lt;/a&gt;) and field referencing (by prefixing field name with $). If these same techniques could be used for update operations that would be a huge improvement. (Is there a ticket for this already?) E.g.:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.foo.update({},{$update:{avg:{$divide:[&quot;$total&quot;,&quot;$count&quot;]}}},false,true);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I imagine this would be a lot faster than JS and have potentially much better concurrency. Also of note is that using the $out pipeline in the aggregation command might provide a faster method of accomplishing the same as the M/R hack.&lt;/p&gt;</comment>
                            <comment id="78717" author="apiggott@ikanow.com" created="Tue, 10 Jan 2012 01:39:15 +0000"  >&lt;p&gt;We do lots of server-side batch scripts of varying complexity (using a completely unsupported/bug feature in map/reduce, oops: &lt;a href=&quot;http://groups.google.com/group/mongodb-user/browse_thread/thread/315d8eebea11dcf/d72a56a04d7e94e7#d72a56a04d7e94e7&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/browse_thread/thread/315d8eebea11dcf/d72a56a04d7e94e7#d72a56a04d7e94e7&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Just a vote for being able to pass in functions declared earlier in javascript, eg something like&lt;/p&gt;

&lt;p&gt;px = function() &lt;/p&gt;
{

// processing on &quot;this&quot;

}

&lt;p&gt;db.coll.update({}, {$function: px})&lt;/p&gt;

&lt;p&gt;(which I think it what is currently proposed - but others seemed to be suggesting passing strings around)&lt;/p&gt;

&lt;p&gt;Since many of our batch scripts are long and complicated, using &quot;proper looking&quot; javascript is already at the edge of maintainability &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;(Obviously happy with strings when using the Java driver since there&apos;s no alternative!) &lt;/p&gt;</comment>
                            <comment id="68478" author="rudiedirkx" created="Wed, 23 Nov 2011 06:20:56 +0000"  >&lt;p&gt;If it&apos;s server-side &amp;#8211; I believe you &amp;#8211; how is&lt;/p&gt;

&lt;p&gt;    $function: function()&lt;/p&gt;
{this.avg = this.total / this.count}

&lt;p&gt;being sent to the server? Converted to string? So no closures? I don&apos;t get it. But don&apos;t let that stop anyone! =)&lt;/p&gt;

&lt;p&gt;I don&apos;t know what you mean by &quot;and it loses any point due to lack of atomicity&quot;...&lt;/p&gt;</comment>
                            <comment id="68476" author="glebtv" created="Wed, 23 Nov 2011 06:11:39 +0000"  >&lt;p&gt;I&apos;m sure this is about server-side execution of a function in updates &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;Client-side you can do it easy anyway and it loses any point due to lack of atomicity.&lt;/p&gt;</comment>
                            <comment id="68475" author="rudiedirkx" created="Wed, 23 Nov 2011 06:06:41 +0000"  >&lt;p&gt;Who says the anonymous function is in Javascript? Pass the document as first argument so practically all languages can use it. No need to pass a Javascript function as string.&lt;/p&gt;

&lt;p&gt;If you&apos;re going with solely Javascript, you&apos;re disadvantaging all other drivers. No fair!&lt;/p&gt;</comment>
                            <comment id="68446" author="glebtv" created="Wed, 23 Nov 2011 02:18:55 +0000"  >&lt;p&gt;Because the only driver that supports anonymous functions written in javascript would be the javascript one.&lt;/p&gt;</comment>
                            <comment id="68445" author="rudiedirkx" created="Wed, 23 Nov 2011 02:12:33 +0000"  >&lt;p&gt;Why so difficult? Why not:&lt;/p&gt;

&lt;p&gt;collection.update(&lt;/p&gt;
{&quot;_id&quot;: &quot;foo&quot;}
&lt;p&gt;, function(doc) { return &lt;/p&gt;
{&quot;avg&quot;: doc.total/doc.count}
&lt;p&gt; })&lt;/p&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;p&gt;collection.update(&lt;/p&gt;
{&quot;_id&quot;: &quot;foo&quot;}
&lt;p&gt;, {&quot;$set&quot;: function(doc) { return &lt;/p&gt;
{&quot;avg&quot;: doc.total/doc.count}
&lt;p&gt; }})&lt;/p&gt;

&lt;p&gt;(The drivers that don&apos;t support anonymous functions just shouldn&apos;t have this feature IMO.)&lt;/p&gt;</comment>
                            <comment id="54360" author="thiloplanz" created="Thu, 15 Sep 2011 07:25:01 +0000"  >&lt;p&gt;For some simple scenarios, there may not even be the need to have Javascript at all. For example just copying values from other fields. There an option to refer to a current field value to use in $set would be sufficient. Or a $copy similar to $rename, except that it does not remove the old field. Is there already a JIRA for this?&lt;/p&gt;</comment>
                            <comment id="42214" author="sethml" created="Thu, 14 Jul 2011 00:38:31 +0000"  >&lt;p&gt;Something to think about: presumably the js will actually be passed as a string, at least for drivers which aren&apos;t the JS shell.  It&apos;d be nice to be able to pass parameters to the JS, in order to avoid SQL-injection type attacks.  Perhaps something like this:&lt;/p&gt;

&lt;p&gt;  myCollection.update(query, { $eval: { $js: &quot;function(newVal) &lt;/p&gt;
{ if (newVal &amp;gt; this.maxVal) this.maxVal = newVal; }
&lt;p&gt;&quot;, $args: &lt;span class=&quot;error&quot;&gt;&amp;#91;myNewVal&amp;#93;&lt;/span&gt; } });&lt;/p&gt;

&lt;p&gt;I don&apos;t know what the options are with the current JS engine, but it would be very nice if it were possible to execute these functions in a manner that doesn&apos;t require locking, presumably by restricting their context to only the object being updated.  (Of course, this would break Milan&apos;s clever pseudo-join - perhaps a variant could allow more global operation, at the expense of more locking.)&lt;/p&gt;</comment>
                            <comment id="33706" author="alikendarfen" created="Fri, 20 May 2011 17:56:55 +0000"  >&lt;p&gt;I imagine the update JS enabled operation like this :&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Updating a field :&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;update( query, { ..., {$js : &lt;/p&gt;
{ fieldName : func( this ) -&amp;gt; value }
&lt;p&gt; }, ... )&lt;/p&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Update the entire object :&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;update( query, {$js-all : func( this ) -&amp;gt; newThis }, .... )&lt;/p&gt;


&lt;p&gt;The idea is to have the choice to use javascript to calculate a single object field or to calculate the entire new object.&lt;/p&gt;

&lt;p&gt;Anyway, this kind of possibilities ARE very important (specially for bulk ops), since the only alternative is now to download objects to client side for doing this... (I dont consider mapreduce possibilities are adapted for this kind of work).&lt;/p&gt;

&lt;p&gt;Hope this (or alternate equivalent) will come soon !!&lt;/p&gt;


&lt;p&gt;Thanks by advance and thanks for the great work you did with Mongo !&lt;/p&gt;


&lt;p&gt;Christian&lt;/p&gt;</comment>
                            <comment id="33138" author="sparrow" created="Tue, 17 May 2011 19:14:53 +0000"  >&lt;p&gt;Thank you both for explaining, I understand now.&lt;/p&gt;</comment>
                            <comment id="33125" author="eliot" created="Tue, 17 May 2011 18:24:03 +0000"  >&lt;p&gt;The estimate is how much work is involved in implementing, not when it will be implemented.&lt;/p&gt;</comment>
                            <comment id="33124" author="sparrow" created="Tue, 17 May 2011 18:19:19 +0000"  >&lt;p&gt;pardon my ignorance, but what does &quot;Estimate &amp;lt; 1 week&quot; mean? Does it mean that this feature will be implemented in an unstable branch very soon?&lt;br/&gt;
Currently I&apos;m employing some ugly hacks to get certain things done in mongodb, and this feature would solve my current bunch of problems.&lt;/p&gt;</comment>
                            <comment id="20515" author="scotthernandez" created="Sat, 20 Nov 2010 05:52:08 +0000"  >&lt;p&gt;It would be nice if this worked in a language/syntax which wasn&apos;t javascript so it could be faster and non-blocking.&lt;/p&gt;</comment>
                            <comment id="13412" author="chx" created="Mon, 5 Apr 2010 03:37:49 +0000"  >&lt;p&gt;Dont forget to allow for xmlhttprequest &amp;lt;evil grin&amp;gt;&lt;/p&gt;

&lt;p&gt;Edit: you know, that&apos;d allow (later) for manual conflict resolution when sharding is coming out of a split-brain situation.&lt;/p&gt;

&lt;p&gt;Edit2: this is just a crazy idea and not important.&lt;/p&gt;</comment>
                            <comment id="13085" author="milaniliev" created="Wed, 17 Mar 2010 16:59:43 +0000"  >&lt;p&gt;This will obviate the need for many an eval(), and allow for pseudo-join updates by doing something like&lt;/p&gt;

&lt;p&gt;name: function(){ return db.users.find({_id: this.user_id}).name }&lt;/p&gt;

&lt;p&gt;In short, very much looking forward to it &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="82302">SERVER-10213</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="13056">SERVER-1765</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="725206">SERVER-40381</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="43910">SERVER-6399</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="71566">SERVER-9336</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="10669">SERVER-925</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="95566">SERVER-11345</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>34.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25143"><![CDATA[Query]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000UaTYRIA3]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 17 Mar 2010 16:59:43 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        4 years, 32 weeks, 4 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-1021</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 32 weeks, 4 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>ahildoer</customfieldvalue>
            <customfieldvalue>apiggott@ikanow.com</customfieldvalue>
            <customfieldvalue>sparrow</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-query</customfieldvalue>
            <customfieldvalue>alikendarfen</customfieldvalue>
            <customfieldvalue>colinmollenhour</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>ehremo</customfieldvalue>
            <customfieldvalue>glebtv</customfieldvalue>
            <customfieldvalue>diversario</customfieldvalue>
            <customfieldvalue>chx</customfieldvalue>
            <customfieldvalue>trumpetinc</customfieldvalue>
            <customfieldvalue>justanyone</customfieldvalue>
            <customfieldvalue>mathias@mongodb.com</customfieldvalue>
            <customfieldvalue>milaniliev</customfieldvalue>
            <customfieldvalue>ms</customfieldvalue>
            <customfieldvalue>oleg@evergage.com</customfieldvalue>
            <customfieldvalue>rubytuesdaydono</customfieldvalue>
            <customfieldvalue>rudiedirkx</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
            <customfieldvalue>sethml</customfieldvalue>
            <customfieldvalue>sim</customfieldvalue>
            <customfieldvalue>slugfiller</customfieldvalue>
            <customfieldvalue>tamasnagy</customfieldvalue>
            <customfieldvalue>thiloplanz</customfieldvalue>
            <customfieldvalue>zhouao</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpu3j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr749j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4975</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hs5nsn:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>