[CSHARP-2144] Option to save list or entity as DBRef Created: 06/Jan/18  Updated: 01/Feb/18  Resolved: 01/Feb/18

Status: Closed
Project: C# Driver
Component/s: Serialization
Affects Version/s: 2.5
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Marcos Almeida Jr. Assignee: Robert Stam
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Some kind of mapping that tells driver to store a document reference instead of plain document.

Example

            map.MapMember(x => x.UserOwner /*one user*/)
                .SetIsReference("Users" /*collectionName*/)
                .SetIsRequired(true);
 
            map.MapMember(x => x.AssociatedProfiles /* many profiles */)
                .SetIsReference("Profiles" /*collectionName*/)
                .SetIsRequired(true);

UserOwner returns User instead of MongoDBRef
AssociatedProfiles returns IList<Profile> (instead of MongoDBRef[])



 Comments   
Comment by Robert Stam [ 01/Feb/18 ]

This is not possible because serialization (the process of converting a C# object to a BSON document representation) is handled by the BSON layer which is below and independent of the driver, and therefore has no access to the database at all.

Generated at Wed Feb 07 21:41:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.