[
{
_id: ObjectId("641e3c070fb20438f24d1659"),
firstName: 'Max',
lastName: 'Chavan',
age: 29,
history: [
{ disease: 'cold', treatment: 'steam' },
{ disease: 'malaria', treatment: 'injection' }
]
},
{
_id: ObjectId("641e3c3d0fb20438f24d165a"),
firstName: 'Aditya',
lastName: 'Methe',
age: 25,
history: [
{ disease: 'cancer', treatment: 'none' },
{ disease: 'chickengunia', treatment: 'none' }
]
},
{
_id: ObjectId("641e3c5d0fb20438f24d165b"),
firstName: 'Lokesh',
lastName: 'Vakhare',
age: 25,
history: [
{ disease: 'fever', treatment: 'medicine' },
{ disease: 'chickenpox', treatment: 'injection' }
]
}
]
[
{
_id: ObjectId("641e3c070fb20438f24d1659"),
firstName: 'Max',
lastName: 'Chavan',
age: 29,
history: [
{ disease: 'cold', treatment: 'steam' },
{ disease: 'malaria', treatment: 'injection' }
]
},
{
_id: ObjectId("641e3c3d0fb20438f24d165a"),
firstName: 'Aditya',
lastName: 'Methe',
age: 25,
history: [
{ disease: 'cancer', treatment: 'none' },
{ disease: 'chickengunia', treatment: 'none' }
]
},
{
_id: ObjectId("641e3c5d0fb20438f24d165b"),
firstName: 'Lokesh',
lastName: 'Vakhare',
age: 25,
history: [
{ disease: 'fever', treatment: 'medicine' },
{ disease: 'chickenpox', treatment: 'injection' }
]
}
]
The above database is a mongoDb database.
I am trying to write a query that deletes all patients that have cold as a disease.
Here is my query,
db.patient.remove(history.{disease:"cold",treatment:'steam'})
However, the query gives the following error:
Unexpected token (1:26)
> 1 | db.patient.remove(history.{disease:"cold",treatment:'steam'})
| ^
2 |
How do I resolve it?