Bson.opIndex

Allows index based access of a BSON array value.

Returns a null value if the index is out of bounds.

  1. inout(Bson) opIndex(string idx)
  2. inout(Bson) opIndex(size_t idx)
    struct Bson
    @safe inout
    inout(Bson)
    opIndex
    (
    size_t idx
    )

Examples

Bson[] entries;
entries ~= Bson(1);
entries ~= Bson(true);
entries ~= Bson("foo");

Bson value = Bson(entries);
assert(value[0] == Bson(1));
assert(value[1] == Bson(true));
assert(value[2] == Bson("foo"));

Meta