I'm working in Golang
and mgo
and I would like to delete all the documents in a collection older than a specified date, using _id
value.
So far I've tried to create a dummy objectId using a struct NewObjectIdWithTime
after that I'm trying to delete documents using
collection.Remove(bson.M{"_id": bson.M{"$lt": objectId}})
But I'm not getting any results, any suggestion?