mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Make reference fields a proxy to allow access to field.id without dereferencing

Open rozza opened this issue 12 years ago • 17 comments

When looking at any other value then trigger a dereference either directly or on the list.

refs: #61

rozza avatar Apr 26 '13 12:04 rozza

Has anybody started this?

thedug avatar Nov 25 '13 04:11 thedug

I havent started 0.9 development yet

rozza avatar Nov 28 '13 15:11 rozza

Just to let you know, I'm interested in this feature as well.

Fraggle avatar Mar 03 '14 17:03 Fraggle

+1 for this

lwcolton avatar Nov 12 '14 16:11 lwcolton

Is 0.9 still in the works or is mongoengine stalled?

thedug avatar Nov 13 '14 15:11 thedug

+1 This would be a great addition for things like uniqueness checks in a list of referenceField's

bsherry avatar Nov 15 '14 01:11 bsherry

+1

bond777 avatar Nov 20 '14 12:11 bond777

Definitely a good optimization to have ! But I would rather release a 0.9 now and postpone this to a new release

MRigal avatar Dec 12 '14 10:12 MRigal

And it might be a good idea to have #490 in mind while implementing the concept for this issue

MRigal avatar Dec 12 '14 16:12 MRigal

Are we able to access a referencefield to obtain the ID & avoid the dereference overhead yet? Thanks.

+1

smcclstocks avatar Jul 23 '15 20:07 smcclstocks

+1

computmaxer avatar Oct 03 '15 18:10 computmaxer

+1

codekiln avatar Sep 27 '16 12:09 codekiln

+1

pchristos avatar Nov 30 '16 07:11 pchristos

We've implemented this (among many other things) in my company's fork of this package (https://github.com/closeio/mongoengine#mongomallard). I'll try to move the performance improvements (including this one) over to this package.

PS GitHub has added reactions to their UI now (https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) so that we don't need to create "+1" comments.

wojcikstefan avatar Nov 30 '16 13:11 wojcikstefan

This is very needed update. Is there any progress on this one? (Also wonder if it would be possible to check whether field is a reference proxy like it was possible to check via isinstance(field, DBRef)?)

mclate avatar Jun 19 '17 20:06 mclate

+1

djrochford avatar Jul 12 '19 13:07 djrochford

Is this still an issue? LazyReferenceField and the no_dereference context manager have both been added since this was reported. LazyReferenceField in particular appears to specifically call out this use case of wanting to access an id of a ReferenceField value without dereferencing the entire object.

NoahStapp avatar Jun 09 '25 18:06 NoahStapp