I recently ran into the same problem, and I usually shy away from them, but ... I think this might be useful for a significant numbering system deployed in the Id field.
class Thing { string Id {get; set;} string Name {get; set;} string RelatedThing {get; set;}}
So, simplifying if Id was something like โT00001โ (or even T + GUID), you could easily get a lot of things from Mongo by requesting something like Id starting with T and creating objects for them (or just for the subset that you know contains your link if it's a very large set).
You know / expect RelatedThing to be a thing, but it will just be a string when it returns from Mongo. But if you configured the objects as described above, you could effectively use this line as if it were a reference to the object (in the end, this is what actually happens, done โmanuallyโ).
His "free" way to do this, but may be useful to you.
Can anyone see any pitfalls with this approach?
FrugalTPH
source share