【发布时间】:2021-12-10 08:19:31
【问题描述】:
如何用updateLyric的值覆盖officialLyric的值??
artist: { type: String, required: true },
title: { type: String, required: true },
officialLyric: { type: String, required: true },
editedLyrics: [
{
updatedLyric: String,
status: {
type: String,
enum: ["Aproved", "Rejected", "Pending"],
default: "Pending",
},
userId: { type: Schema.Types.ObjectId, required: true, ref: "User" },
},
],
releaseDate: { type: Date },
查看图片以清楚地描述问题。
【问题讨论】:
-
属性
updatedLyric在数组editedLyrics中,表示会有多个元素,officialLyric中应该更新哪个元素的值? -
是的,editedLyrics 数组可以容纳许多持有updatedLyric 的对象,所以我希望任一updatedLyric 来更新officialLyric
标签: node.js mongodb mongoose schema backend