It's an issue in DataGrip, the query works well in mongosh 1.5.0.
Test Data:
Suppose I a collection for test like this, in which the fields are _id, address, id:

Note field address goes before field id.
Query:
db.testaa.aggregate([
{
$project: {
_id: "$_id",
id: "$id",
address: "$address",
}
}]);
The Problem:
The query is to project fields and expect the field id goes before field address. it works well in Mongosh 1.5.0 but not work in DataGrip (2021.3.1, with driver ver. 1.15, JDBC4.2). In DataGrip, it returns the correct fields values but in default order, instead of the specified order in project expression.
It's an issue in DataGrip, the query works well in mongosh 1.5.0.
Test Data:
Suppose I a collection for test like this, in which the fields are _id, address, id:

Note field
addressgoes before fieldid.Query:
The Problem:
The query is to project fields and expect the field
idgoes before fieldaddress. it works well in Mongosh 1.5.0 but not work in DataGrip (2021.3.1, with driver ver. 1.15, JDBC4.2). In DataGrip, it returns the correct fields values but in default order, instead of the specified order in project expression.