How to test equality of MongoDB filters (BSON) in Java/Groovy? -
i'm generating mongodb-queries unsing filters-api.
bson r1 = filters.and(filters.eq("a","b"), filters.eq("c","d")) bson r2 = filters.and(filters.eq("a","b"), filters.eq("c","d"))
but how can check result equality? example:
r1.equals(r2)
and
r1.dump().equals(r2.dump())
don't work.
one thing is:
- convert bson bsondocument
- compare json strings
here found on https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/mongodb-user/peel8wiwxwa/zhpyglqedqaj
bsondocument b1 = r1.tobsondocument(bsondocument.class, mongoclient.default_codec_registry); bsondocument b2 = r2.tobsondocument(bsondocument.class, mongoclient.default_codec_registry);
Comments
Post a Comment