DATAMONGO-2475 - MongodbDocumentSerializer: reduce nested ANDs and ORs.
Reduce the number of nested $and / $or clauses by combining them into a single document where possible. This allows to simplify the following statement
{
"$or": [
{
"$or": [
{
"$or": [
{
"$or": [
{ "firstname": "Hencxjo" },
{ "lastname": "Leon" }
]
},
{ "age": { "$lte": 30 } }
]
},
{ "age": { "$gte": 20 } }
]
},
{ "uniqueId": { "$exists": false } }
]
}
to just
{
"$or": [
{ "firstname": "Hencxjo" },
{ "lastname": "Leon" },
{ "age": { "$lte": 30 } },
{ "age": { "$gte": 20 } },
{ "uniqueId": { "$exists": false } }
]
}
Original Pull Request: #834