Mgo 聚合管道 $not 运算符。未知的顶级操作员

Mgo Aggregate pipline $not operator. Unknown top level operator

我正在尝试使用 Mgo 驱动程序创建聚合管道。对于以下设置,我将 运行 保留为未知的顶级运算符 $not 问题。我是使用 go 和 mongo 的初学者。我正在创建此管道以过滤掉不符合特定条件(例如他们处于活动状态)的用户。有没有更简单的方法来完成这个?

 today := time.Now()   
 pipe2 := bson.M{"$match": bson.M{
                 "$not": []bson.M{
                         bson.M{StartDate: bson.M{"$gte": today}},
                         bson.M{EndDate: bson.M{"$lte": today}}}}}

$not 接受对象,而不是数组:

https://docs.mongodb.com/manual/reference/operator/query/not/

您是否更改了查询:

bson.M{"$match": 
   bson.M{StartDate: 
       bson.M{"$not": bson.M{"$gte": today, "$lte": today}}}}