INNER CODE UNIT · Go
OpLogCollection
rwynn/gtm · gtm.go:945
func OpLogCollection(client *mongo.Client, o *Options) *mongo.Collection {
localDB := client.Database(o.OpLogDatabaseName)
return localDB.Collection(o.OpLogCollectionName)
}
func ParseTimestamp(timestamp primitive.Timestamp) (uint32, uint32) {
return timestamp.T, timestamp.I
}
func validOps() bson.M {
return bson.M{"op": bson.M{"$in": opCodes}}
}
func LastOpTimestamp(client *mongo.Client, o *Options) (primitive.Timestamp, error) {
opLog := OpLog{}
filter := validOps()
opts := &options.FindOneOptions{}
opts.SetSort(bson.M{"$natural": -1})