我正在尝试使用Express从Mongoose的子文档中删除嵌套项目,但我似乎无法使其工作
这是文档:
<table class="table table-striped">
<tr>
<th style="text-align: right!important;">
Nombre del Evento:
</th>
<td>
<input readonly class="form-control" name="nomb" value="" id="nomb" type="text">
</td>
</tr>
<tr>
<th style="text-align: right!important;">
Precio de entrada:
</th>
<td>
<input readonly class="form-control" name="precio" id="precio" onkeydown="alpha(this)" onkeyup="alpha(this)" onblur="alpha(this)" onclick="alpha(this)" value="" type="text">
</td>
</tr>
<tr>
<th style="text-align: right!important;">
Ciudad:
</th>
<td>
<input readonly class="form-control" onkeydown="ime(this)" onkeyup="ime(this)" onblur="ime(this)" onclick="ime(this)" name="ciudad" id="ciudad" value="" type="text">
</td>
</tr>
<tr>
<th style="text-align: right!important;">
Fecha:
</th>
<td>
<input readonly class="form-control" onkeydown="ime(this)" onkeyup="ime(this)" onblur="ime(this)" onclick="ime(this)" name="fecha" id="fecha" value="" type="date">
</td>
</tr>
<tr>
<th style="text-align: right!important;">
Hora:
</th>
<td>
<input readonly class="form-control" name="hora" id="hora" onkeydown="emailk(this)" onkeyup="emailk(this)" onblur="emailk(this)" onclick="emailk(this)" value="" type="time">
</td>
</tr>
</table>
<div>
<h4>Condiciones del Evento: </h4>
<p>aquí las condiciones del evento</p>
</div>
现在我正尝试使用Express删除消息数组中的对象:
{
"_id" : ObjectId("5c4adf6a89679a1c0f5a15d4"),
"title" : "TestItem",
"subitem" : [
{
"_id" : ObjectId("5c4adf7189679a1c0f5a15d5"),
"title" : "Test",
"messages" : [
{
"_id" : ObjectId("5c4ae0001c5b3f1c57470a32"),
"type" : "single_article",
"date" : "Jan 25, 2019",
"title" : "Test",
"text" : "<p>Test</p>"
}
]
}
],
"__v" : 0
}
“ id”变量是消息数组中的ID