()
| 49 | } |
| 50 | |
| 51 | func (nr *NodeReaper) getQuery() (query bson.M) { |
| 52 | hasExpire := bson.M{"expiration": bson.M{"$exists": true}} // has the field |
| 53 | toExpire := bson.M{"expiration": bson.M{"$ne": time.Time{}}} // value has been set, not default |
| 54 | isExpired := bson.M{"expiration": bson.M{"$lt": time.Now()}} // value is too old |
| 55 | query = bson.M{"$and": []bson.M{hasExpire, toExpire, isExpired}} |
| 56 | return |
| 57 | } |