In this example, I want to delete an object from the answers array whose text field matches with the one I have passed in the query.
This is my schema for the QAns Model:

```
const QuestAnsSchema = new Schema({
    text: String,
    author_id: String,
    author_name: String,
    answered: Boolean,
    answers: [{
        text: String,
            author_id: String,
            author_name: String,
        }]
});

```

And this is the data in the database

```
{
    "_id":{
        "$oid":"5ee7########989ca"
    },
    "text":"hyfffffff",
    "author_id":"5ee749##########8081e",
    "author_name":"Gamerz One",
    "answered":false,
    "answers":[],
    "__v":{"$numberInt":"0"}
},

{
    "_id": {
        "$oid":"5ee767ee8b57ee30e0dadac8"
    },
    "text":"What is your name?",
    "author_id":"5ee749b44c3d1d13cc08081e",
    "author_name":"Gamerz One",
    "answered":true,
    "answers":[
        {
            "_id": {
                "$oid":"5ee8ec9a68698c2d1cb4e043"
            },
            "text":"My name is gamerz\r\n",
            "author_id":"5ee1b8ebdbf91b23a808d417",
            "author_name":"Gamerz One"
        },  
        {
            "_id": {
                "$oid":"5eea07f832d091080cc047f2"
            },
            "text":"my name is kunal nalaawde",
            "author_id":"5ee749b44c3d1d13cc08081e",
            "author_name":"Gamerz One"
        }
    ],
    "__v":{"$numberInt":"6"}
 }

```

There is a whole document consosting of QAns object which have an answers array inside them. Now I want to delete one object from answers array which belongs to the particular question.
For example, from the above data I want to delete the answer "My name is gamerz" from the question "What is your name" by passing the answer text in the query.

I have tried this code but it isnt working

```
QAns.findOneAndUpdate({ text: questionText }, { $pull: { answers: { text: ansText} }  })
    .then((result,err) => {
        if (err) console.log(err);
        else console.log(result);
    })

```

* `QAns` is the model name
* `questionText` is the question text whose answer is supposed to be deleted
* `ansText` is the answer text and the object containing this text is supposed to be deleted from the
answers array of the question