Learn R Programming

rmongodb (version 1.8.0)

mongo.bson.buffer.append.undefined: Append a undefined field onto a mongo.bson.buffer

Description

Append a undefined value onto a mongo.bson.buffer.

Usage

mongo.bson.buffer.append.undefined(buf, name)

Arguments

buf
(mongo.bson.buffer) The buffer object to which to append.
name
(string) The name (key) of the field appended to the buffer.

Value

TRUE if successful; otherwise, FALSE if an error occured appending the data.

Details

BSON has a special field type to indicate an undefined value. This function appends such an indicator as the value of a field.

See Also

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

Examples

Run this code
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append.undefined(buf, "Undef")
b <- mongo.bson.from.buffer(buf)

# The above produces a BSON object of the form { "Undef" : UNDEFINED }

# The same result can be produced by the following code:
buf <- mongo.bson.buffer.create()
undef <- mongo.undefined.create()
mongo.bson.buffer.append(buf, "Undef", undef)
b <- mongo.bson.from.buffer(buf)

Run the code above in your browser using DataLab