0

I want to delete element in array

Here I find such element of array

db.getCollection('files').aggregate([{'$unwind': "$Package.PackageBody.InvestmentVehicle"},{'$match': { "Package.PackageBody.InvestmentVehicle.Name": "file.txt"}}])

It's better in one command.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

I found the solution, it delete element of array, but unfortunately leave NULL ,instead of total delete.

db.getCollection('typeE').update(
    { "Package.PackageBody.InvestmentVehicle.Operation.LegalName": "FileName" },
    {
        "$unset": {
            "Package.PackageBody.InvestmentVehicle.$": ""
        }
    },false,true
)