Skip to content

Configure MongoDB collection (index) TTL #13

@a-filimonov

Description

@a-filimonov

We need to set a TTL for a collection stored in MongoDB for Mailhog.

This can easily be done here:

err = session.DB(db).C(coll).EnsureIndexKey("created")

Like this:

	err = session.DB(db).C(coll).EnsureIndex(Index{Key:"created",ExpireAfter:60})

where 60 is the TTL in seconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions