// IEnumerable<CompareDocumentResult> public static CompareDocumentsResult CompareBsonDocumentFilesWithKey(string file1, string file2, string key1, string key2, JoinType joinType = JoinType.InnerJoin, DocumentComparatorOptions comparatorOptions = DocumentComparatorOptions.ReturnNotEqualDocuments, EnumerateElementsOptions enumerateElementsOptions = EnumerateElementsOptions.None, IEnumerable <string> elementsToCompare = null) { IEnumerable <TwoDocuments> query = zMongo.BsonRead <BsonDocument>(file1).zJoin( zMongo.BsonRead <BsonDocument>(file2), document1 => document1[key1], document2 => document2[key2], (document1, document2) => new TwoDocuments { Key = document1 != null ? document1.zGet(key1) : document2.zGet(key2), Document1 = document1, Document2 = document2 }, joinType); DocumentComparator comparator = new DocumentComparator(); comparator.SetComparatorOptions(comparatorOptions); comparator.SetEnumerateElementsOptions(enumerateElementsOptions); comparator.SetElementsToCompare(elementsToCompare); CompareDocumentsResult result = comparator.Compare(query); result.Source1 = file1; result.Source2 = file2; return(result); }
public static CompareDocumentResult CompareBsonDocuments(BsonDocument document1, BsonDocument document2, DocumentComparatorOptions comparatorOptions = DocumentComparatorOptions.ReturnNotEqualDocuments, EnumerateElementsOptions enumerateElementsOptions = EnumerateElementsOptions.None, IEnumerable <string> elementsToCompare = null) { DocumentComparator comparator = new DocumentComparator(); comparator.SetComparatorOptions(comparatorOptions); comparator.SetEnumerateElementsOptions(enumerateElementsOptions); comparator.SetElementsToCompare(elementsToCompare); return(comparator.CompareBsonDocuments(new TwoDocuments { Document1 = document1, Document2 = document2 })); }
// IEnumerable<CompareDocumentResult> public static CompareDocumentsResult CompareBsonDocumentFiles(string file1, string file2, DocumentComparatorOptions comparatorOptions = DocumentComparatorOptions.ReturnNotEqualDocuments, EnumerateElementsOptions enumerateElementsOptions = EnumerateElementsOptions.None, IEnumerable <string> elementsToCompare = null, IEnumerable <string> documentReference = null) { var query = EnumarateTwoBsonDocumentsList(zMongo.BsonRead <BsonDocument>(file1), zMongo.BsonRead <BsonDocument>(file2)); DocumentComparator comparator = new DocumentComparator(); comparator.SetComparatorOptions(comparatorOptions); comparator.SetEnumerateElementsOptions(enumerateElementsOptions); comparator.SetElementsToCompare(elementsToCompare); comparator.SetDocumentReference(documentReference); CompareDocumentsResult result = comparator.Compare(query); result.Source1 = file1; result.Source2 = file2; return(result); }