elasticsales/flask-mongorest — pull request #51 by wojcikstefan (2014-01-21 23:29:03+00:00)
Title: Optimize updates in terms of DB queries

Optimizes comparison of reference fields by comparing the ids and not performing a full db lookup.

Before:
![screen shot 2014-01-21 at 3 27 21 pm](https://f.cloud.github.com/assets/1718372/1969509/ba0e1422-82f3-11e3-90e0-cdc110b07061.png)

After:
![screen shot 2014-01-21 at 3 27 44 pm](https://f.cloud.github.com/assets/1718372/1969512/c2b248d2-82f3-11e3-91a6-39dd9860d92d.png)

Request used:
```
In [178]: api.put('activity/note/acti_StCE9f8m5KGW8XwLIMn0J03Lb8Mddua3nVwajZD30Oe', data=data)
Out[178]: 'response ok'

In [179]: data
Out[179]:
{u'contact_id': None,
u'id': u'acti_StCE9f8m5KGW8XwLIMn0J03Lb8Mddua3nVwajZD30Oe',
u'is_new': False,
u'lead_id': u'lead_YloqfPbjzc63tKa204gFFPk4QqpZlsZTr81Z33Q0EIM',
u'note': 'whatever',
u'organization_id': u'orga_vfvFDAKGLybddKDJn8n7ElZZ3qyRF3QI8fJxTSAYr5X',
u'user_id': u'user_weWpqmrZZ9sg3FHYQcUwV7tbwZRpe3sA215Ftv8OvbU',
u'users': []}
```