我正在尝试使用 mgo lib 创建一个查询。
q := bson.M{
"$and": bson.M{
"btId": neighbour.BtId,
"timestamp": bson.M{
"$gt": sensorDataStartPoint.Timestamp,
"$lt": sensorDataStartPoint.Timestamp.Add(time.Second * 3000),
},
},
}
所以这呈现为map[$and:map[btId:BTR0102 timestamp:map[$gt:2012-04-11 19:08:59 +0200 CEST $lt:2012-04-11 19:58:59 +0200 CEST]]]但我$and expression must be a nonempty array在尝试执行查询时出错
它应该是 : btId = "123" AND timestamp > sensorDataStartPoint.Timestamp AND timestamp < sensorDataStartPoint.Timestamp + 3000s
繁华开满天机
相关分类