Class DurationAsDocumentCodec

  • All Implemented Interfaces:
    Codec<Duration>, Decoder<Duration>, Encoder<Duration>

    public final class DurationAsDocumentCodec
    extends Object
    implements Codec<Duration>

    Encodes and decodes Duration values to and from BSON Document, such as { seconds: 10, nanos: 100 }.

    The values are stored using the following structure:

    • seconds (a non-null Int64);
    • nanos (a non-null Int32).

    This type is immutable.