Is there any way not to write all the fields one by one in $project
stage.
I mean assume I have database structure as;
name: "",
surname: "",
age: "",
location: "",
_id: "",
bla bla bla
in project
stage assume I just want to split the location
field, the rest of the document is same and should be projected.
db.collection.aggregate([{$project: {"location" : {$split: ["$location" , 0]} }}])
the field list is long, and I update the query as;
db.collection.aggregate([{$project: {name: 1, surname:1, age: 1(and so on)"location" : {$split: ["$location" , 0]} }}])
Is there any short way?