我正在尝试删除文档,但是在执行此操作之前,我想确保未在其他任何收藏夹中引用该文档。下面的示例不起作用:
const Vehicle = require("../models/vehicle");
const Order = require("../models/order");
const FuelCard = require("../models/fuelcard");
const id = req.params.vehicleId;
Vehicle.deleteOne({_id: id}, {id: {$nin: [Order, FuelCard]}})
我应该如何编写此查询?