Convert Date to String in nested array in mongodb
问题 I have a mongodb collection called cases and inside cases I have an array of cases per company object. So the structure is: Inside each case I want to use the createddate (which is a string) and endDate (also string) and convert it to a mongodb date. When I use NoSQLBooster I add the following query: db.cases.aggregate([ { $match: { companyID: 218 }}, { $unwind: "$cases" }, { $match: { 'cases.id': '299' }}, { $addFields: { 'cases.created': new Date('2010-06-21T00:00:00.000'), 'cases.closed':