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.

1

1 Answer 1

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
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.