I have just upgraded my database from 2.4 to 3.2.8 and I have found a grouping issue where records are not grouped that have matching data. We are running with mongoose on compose for hosting.
The issue comes up when I am grouping on a sub-document and all elements in that sub-document. It looks like when the upgrade was complete the ordering of some of the elements changed and that seems to be impacting the group.
It feels like the grouping is taking the entire sub-document as a string and grouping on that string and not looking at it element by element.
For example with the three documents below when I do a group like the below I get three records instead of on.
Group statement:
{$group: {
_id: {
_id: '$person._id',
address: $person.address'
}
}
Document 1:
{
_id: 1234,
name: "my name",
address: {
street: "123 my street",
city : "my city",
state: "state"
}
}
Document 2:
{
_id: 1234,
name: "my name",
address: {
street: "123 my street",
state: "state"
}
}
Document 3:
{
_id: 1234,
name: "my name",
address: {
state: "state"
city : "my city",
street: "123 my street",
}
}