为什么我的 mongo 查询使用 $in 运算符产生错误?

Why is my mongo query using the $in operator producting an error?

以下查询出错:

const pastOrders = await Order.find(
        {user: userId},
        {status: {$in: ["delivered", "refunded"]}}
    ).populate({
        path: 'items.product',
        model: 'Product'
    });

错误:

 MongoServerError: $in requires an array as a second argument, found: string

状态架构如下:

status: {
  type: String,
  default: 'pending',      
  required: true
},

应该是:

.find({user: userId, status: {$in: ["delivered", "refunded"]}})

userId

之后的 },{ 不需要