我使用NodeJS、指挥官和Mongoose来创建一个简单的命令行界面。如果我的delete函数被调用,但在数据库中找不到文档,我希望它说"Document is not exist“。const deleteNote = (label) => { Note.deleteOne({'label': searchdoc) {
console.log('Document does not exist&
Argument passed in must be a single String of 12 bytes or a string of 24 hex characters 我的Index.js mongoose.connectpostcomment", {useUnifiedTopology: true, useNewUrlParser: true, useCreateIndex: true });
title: Stri
当我点击删除一个帖子时,我的控制台是TypeError: post.user.posts.deleteOne is not a function。它删除后给了我这个错误。const post = await Post.findByIdAndDelete(id).populate('user');此代码--我要从post中删除该帖子