google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

Allow id only references (no DBRef) #311

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
At the moment, when you store a @Reference-d field in Mongo through Morphia, it 
looks like:

[
  {"$ns":"Posts","$id":"204967500021_10150745068780022"},
  {"$ns":"Posts","$id":"204967500021_10150745059460022"}
]

However, if the value parameter is given to the @Reference annotation, is the 
ns field really necessary? For large lists, I think it would save a lot of 
space if the above could just be turned into
[
  "204967500021_10150745068780022",
  "204967500021_10150745059460022"
]

Yes, this would prevent schema changes from being backwards compatible in the 
future, but in my case I'm not worried by that. Would you accept a patch that 
adds an 'OmitNamespace' attribute to the @Reference annotation which did this 
collapsing? There's quite a bit of overhead involved in storing sub-documents 
in every single reference.

Thanks!
-Adrian Petrescu

Original issue reported on code.google.com by apetresc on 12 Aug 2011 at 6:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by scotthernandez on 15 Aug 2011 at 10:01

GoogleCodeExporter commented 9 years ago
Thanks for adding this to the Icebox :) Does that imply that if I were to 
submit a patch, it has a chance of being accepted?

Original comment by apetresc on 15 Aug 2011 at 10:18

GoogleCodeExporter commented 9 years ago
Yes (but iceboxing it was a mistake). 

The patch should include an annotation to control this since it could apply to 
@Reference or Key<T> fields.

Original comment by scotthernandez on 15 Aug 2011 at 10:50

GoogleCodeExporter commented 9 years ago

Original comment by scotthernandez on 24 Aug 2011 at 9:28

GoogleCodeExporter commented 9 years ago
I think this is a duplicate of #210

Original comment by heaths.h...@gmail.com on 25 Dec 2011 at 5:57

GoogleCodeExporter commented 9 years ago
Yep, dup

Original comment by scotthernandez on 25 Dec 2011 at 6:02