// Insert identical documents with different field orders
replset [direct: primary] test> db.test.find()
[
{
_id: ObjectId("65a04bdf95d67a5d1230b4c3"),
be:
{
ua: 209268.984375,
coordinates: [ -95.90898701416783, -78.02003547216432 ],
type: 'Point'
}
},
{
_id: ObjectId("65a04c0895d67a5d1230b4c4"),
be:
{
coordinates: [ -95.90898701416783, -78.02003547216432 ],
type: 'Point',
ua: 209268.984375
}
},
{
_id: ObjectId("65a04fae95d67a5d1230b4c5"),
be:
{
coordinates: [ -95.90898701416783, -78.02003547216432 ],
ua: 209268.984375,
type: 'Point'
}
},
{
_id: ObjectId("65a04fd395d67a5d1230b4c6"),
be:
{
type: 'Point',
ua: 209268.984375,
coordinates: [ -95.90898701416783, -78.02003547216432 ]
}
},
{
_id: ObjectId("65a0506095d67a5d1230b4c7"),
be:
{
ua: 209268.984375,
type: 'Point',
coordinates: [ -95.90898701416783, -78.02003547216432 ]
}
},
{
_id: ObjectId("65a050ae95d67a5d1230b4c8"),
be:
{
type: 'Point',
coordinates: [ -95.90898701416783, -78.02003547216432 ],
ua: 209268.984375
}
}
]
// $geoWithin query only matches documents that don't have the numeric field as the first field
replset [direct: primary] test> db.test.find({ $or: [{ "be": { $geoWithin:
{ $centerSphere: [[179.03531532305314, 0.7050703681776871], 2.145221550434281] }
} }] })
[
{
_id: ObjectId("65a04c0895d67a5d1230b4c4"),
be:
{
coordinates: [ -95.90898701416783, -78.02003547216432 ],
type: 'Point',
ua: 209268.984375
}
},
{
_id: ObjectId("65a04fae95d67a5d1230b4c5"),
be:
{
coordinates: [ -95.90898701416783, -78.02003547216432 ],
ua: 209268.984375,
type: 'Point'
}
},
{
_id: ObjectId("65a04fd395d67a5d1230b4c6"),
be:
{
type: 'Point',
ua: 209268.984375,
coordinates: [ -95.90898701416783, -78.02003547216432 ]
}
},
{
_id: ObjectId("65a050ae95d67a5d1230b4c8"),
be:
{
type: 'Point',
coordinates: [ -95.90898701416783, -78.02003547216432 ],
ua: 209268.984375
}
}
]