Change the `_id` field name and value

you may want to do this on the server side:

const aggregation = [
  {
    $addFields: { value: { $toString: "$_id" }, text: "$name" }
  },
  {
    $project: { _id:0, value:1, text:1 }
  }
];

db.yourcollection.aggregate(aggregation);

this one is in javascript/mongo shell format. edit/change it as required to PHP :slight_smile: