/// <summary> /// Follows the reference. /// </summary> /// <typeparam name = "T"></typeparam> /// <param name = "reference">The reference.</param> /// <returns></returns> public T FollowReference <T>(DBRef reference) where T : class { if (reference == null) { throw new ArgumentNullException("reference", "cannot be null"); } var query = new Document().Add("_id", reference.Id); return(GetCollection <T>(reference.CollectionName).FindOne(query)); }
/// <summary> /// Gets the document that a reference is pointing to. /// </summary> /// <param name = "reference">The reference.</param> /// <returns></returns> public Document FollowReference(DBRef reference) { if (reference == null) { throw new ArgumentNullException("reference", "cannot be null"); } var query = new Document().Add("_id", reference.Id); return(this[reference.CollectionName].FindOne(query)); }