[CSHARP-1407] How to resolve DBRefs to it's document with LINQ ? Created: 12/Sep/15  Updated: 05/Apr/19  Resolved: 14/Sep/15

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

Type: Task Priority: Major - P3
Reporter: Mohsen [X] Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

public class Human
{

public List<MongoDB.Driver.MongoDBRef> Houses

{ get; set; }

}

I couldn't find any way to resolve DBRef to it's type with LINQ.
How to get house document with LINQ ?



 Comments   
Comment by Craig Wilson [ 14/Sep/15 ]

Hi Mohsen,

DbRefs are there for backwards compatibility, but they really should be considered deprecated and not used. We will not be adding support for them in LINQ.

Rather than use a DbRef, you can simply know what database and collection the "referenced" field is from and, if you need to store the information, simply store the information along-side the field. DbRefs have no special meaning to the server.

Craig

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