public static IEnumerable<CompareBsonDocumentsResult> CompareBsonDocumentFiles(string file1, string file2, BsonDocumentComparatorOptions comparatorOptions = BsonDocumentComparatorOptions.ReturnNotEqualDocuments, EnumerateElementsOptions enumerateElementsOptions = EnumerateElementsOptions.None, IEnumerable<string> elementsToCompare = null, IEnumerable<string> documentReference = null) { var query = EnumarateTwoBsonDocumentsList(zmongo.BsonRead<BsonDocument>(file1), zmongo.BsonRead<BsonDocument>(file2)); BsonDocumentComparator comparator = new BsonDocumentComparator(); comparator.SetComparatorOptions(comparatorOptions); comparator.SetEnumerateElementsOptions(enumerateElementsOptions); comparator.SetElementsToCompare(elementsToCompare); comparator.SetDocumentReference(documentReference); return comparator.Compare(query); }
public static CompareBsonDocumentsResult CompareBsonDocuments(BsonDocument document1, BsonDocument document2, BsonDocumentComparatorOptions comparatorOptions = BsonDocumentComparatorOptions.ReturnNotEqualDocuments, EnumerateElementsOptions enumerateElementsOptions = EnumerateElementsOptions.None, IEnumerable<string> elementsToCompare = null) { BsonDocumentComparator comparator = new BsonDocumentComparator(); comparator.SetComparatorOptions(comparatorOptions); comparator.SetEnumerateElementsOptions(enumerateElementsOptions); comparator.SetElementsToCompare(elementsToCompare); return comparator.CompareBsonDocuments(new TwoBsonDocuments { Document1 = document1, Document2 = document2 }); }
public static IEnumerable<CompareBsonDocumentsResult> CompareBsonDocumentFilesWithKey(string file1, string file2, string key1, string key2, JoinType joinType = JoinType.InnerJoin, BsonDocumentComparatorOptions comparatorOptions = BsonDocumentComparatorOptions.ReturnNotEqualDocuments, EnumerateElementsOptions enumerateElementsOptions = EnumerateElementsOptions.None, IEnumerable<string> elementsToCompare = null) { IEnumerable<TwoBsonDocuments> query = zmongo.BsonRead<BsonDocument>(file1).zJoin( zmongo.BsonRead<BsonDocument>(file2), document1 => document1[key1], document2 => document2[key2], (document1, document2) => new TwoBsonDocuments { Key = document1 != null ? document1.zGet(key1) : document2.zGet(key2), Document1 = document1, Document2 = document2 }, joinType); BsonDocumentComparator comparator = new BsonDocumentComparator(); comparator.SetComparatorOptions(comparatorOptions); comparator.SetEnumerateElementsOptions(enumerateElementsOptions); comparator.SetElementsToCompare(elementsToCompare); return comparator.Compare(query); }