【发布时间】:2020-01-10 14:29:26
【问题描述】:
我的 MongoDB 中有一个对象:
{
"title": "Amazing Spider Man 2",
"description":
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s",
"image": "https://wallpaperaccess.com/full/35357.jpg",
"price": 150,
"screen": 1,
"dates": [
{
"date": "2014-02-01T09:28:56.321-10:00",
"rows": [
{
"seats": [
{ "booked": true },
{ "booked": true },
{ "booked": false }
]
},
{
"seats": [
{ "booked": false },
{ "booked": true },
{ "booked": false}
]
},
{
"seats": [
{ "booked": false },
{ "booked": true},
{ "booked": false }
]
}
]
},
我想使用 Express 更新“已预订”的属性。而且我不知道如何以最好的方式做到这一点:) 我对 Node.js 和 Mongo 很陌生,所以我会非常感谢任何帮助。 谢谢!
【问题讨论】:
-
你在app里有express运行和配置吗?
-
是的。我已经写了简单的获取、发布路线。
-
你是如何通过 mongoose 在节点中访问 mongodb 的?
-
是的,我正在使用猫鼬。
标签: javascript node.js mongodb express