mongo.undefined: The mongo.undefined class

Description Details See Also Examples

Description

Objects of class "mongo.undefined" are used to represent undefined values in BSON documents.

Details

mongo.undefined objects are strings (a character vector) with a single value of "UNDEFINED"

mongo.undefined objects have "mongo.undefined" as their class so that
mongo.bson.buffer.append() may detect them and append the appropriate BSON undefined value to a buffer.

These mongo.undefined values may also be present in a list and will be handled properly by mongo.bson.buffer.append.list() and mongo.bson.from.list().

See Also

mongo.undefined.create,
mongo.bson.buffer.append,
mongo.bson.buffer.append.list,
mongo.bson.buffer,
mongo.bson.

Examples

1
2
3
4
5
6
7
8
9
buf <- mongo.bson.buffer.create()
undef <- mongo.undefined.create()
mongo.bson.buffer.append(buf, "Undef", undef)
l <- list(u1 = undef, One = 1)
mongo.bson.buffer.append.list(buf, "listWundef", l)
b <- mongo.bson.from.buffer(buf)

# the above will create a mongo.bson object of the following form:
# { "Undef": UNDEFINED, "listWundef" : { "u1" : UNDEFINED, "One" : 1 } }

jonkatz2/rmongodb documentation built on May 19, 2019, 7:30 p.m.