I not really sure about your question, so I will cover 2 options. On both, I will assume that you are making an update on the spa collection.
1) Removing the images field from the document
To totally remove the field images from the desired document you can use the MongoDB $unset operator, as:
Original document:
{
_id : ObjectId('some_id'),
name : 'abc.jpg',
contactNumbers: '...',
address: '...',
images: ['...']
}
Update method:
Spa.update(
{ name : 'abc.jpg', _id : ObjectId('some_id') },
{ $unset : { images : null } }
);
That will result in the :
{
_id : ObjectId('some_id'),
name : 'abc.jpg',
contactNumbers: '...',
address: '...'
}
2) Removing one element within the images field
If you are trying to remove just one element with a specific value from the images array, you can use the MongoDB $pull operator, like:
Original document:
{
_id : ObjectId('some_id'),
name : '...',
contactNumbers: '...',
address: '...',
images: ['123.jpg','abc.jpg','def.jpg']
}
Update method:
Spa.update(
{ _id : ObjectId('some_id') },
{ $pull : { images : 'abc.jpg' } }
);
That will result in the :
{
_id : ObjectId('some_id'),
name : '...',
contactNumbers: '...',
address: '...',
images: ['123.jpg','def.jpg']
}
I hope that is what you looking for. =]