【发布时间】:2023-02-25 13:06:04
【问题描述】:
我正在为猫鼬中的按位运算符编写类型。
在那,它说
The field value must be either numeric or a BinData instance. Otherwise,
$bitsAllClear
will not match the current document.
这里 BinData 的打字稿类型应该是什么?
【问题讨论】:
标签: typescript
我正在为猫鼬中的按位运算符编写类型。
在那,它说
The field value must be either numeric or a BinData instance. Otherwise,
$bitsAllClear
will not match the current document.
这里 BinData 的打字稿类型应该是什么?
【问题讨论】:
标签: typescript
你可以这样写
type BinData = {
subtype: number;
buffer: Buffer;
};
并像这样在您的模式中使用它
const schema = new mongoose.Schema({
bitmaskBinData: {
type: Number | BinData, // allow numeric or BinData values
required: true
}
});
【讨论】: