Details
-
New Feature
-
Resolution: Won't Fix
-
Trivial - P5
-
None
-
None
-
None
-
Query
-
Fully Compatible
Description
IMHO writing aggregation for simple join operations are big efforts and some syntax improvements will be good. I know JSON has limitations and lots of stuff that I don't know about server core. But let me express my ideas:
For instance basic calculations and string concats:
db.collection.find({}, {_id: 1, name: 1, "nonExistField": {$statement: "1 + 4"}}); |
for just concatanation:
db.collection.find({}, {_id: 1, name: 1, "newField": {$concat: "$firstName + ' ' + $lastName"}}); |
or sum operations:
db.collection.find({}, {_id: 1, "total": {$sum: "$age"}}); |
and for join operations:
this is a sample User collection:
{
|
"_id" : ObjectId("592e75ebe076c31cee205b72"), |
"name": "Test User", |
"tags": [ |
DBRef("tag", ObjectId("592e75ebe076c31cee205b77")), |
DBRef("tag", ObjectId("592e75ebe076c31cee205b78")) |
]
|
}
|
{
|
'tags.$join': {'$elemMatch': {'name': {'$regex': '^test', '$options': 'i'}}} |
}
|
Server can convert my query to an aggregation query but as a simple user It's a big effort.
Attachments
Issue Links
- related to
-
SERVER-29971 Readable Aggregation Formulas
-
- Closed
-