Learn R Programming

rmongodb (version 1.8.0)

mongo.bson.buffer.append.time: Append a time value into a mongo.bson.buffer

Description

Append a date/time value into a mongo.bson.buffer.

Usage

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

Arguments

buf
(mongo.bson.buffer) The buffer object to which to append.
name
(string) The name (key) of the field appended to the buffer.
time
(integer) A time value. This may also be an object of class "POSIXct", "POSIXlt" or "mongo.timestamp".

Value

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

Details

BSON has a special field type to indicate a date/time; these are 64-bit values.

However, R has a 'standard' object of class "POSIXct" used to represent date/time values, such as that returned by Sys.time(). Internally these are a 32-bit integer number of milliseconds since midnight January 1, 1970. On January 19, 2038, 32-bit versions of the the Unix time stamp will cease to work, as it will overflow the largest value that can be held in a signed 32-bit number. At such time, many applications, including R and this driver, will need to address that issue.

See Also

mongo.timestamp, mongo.timestamp.create, mongo.bson.buffer.append, mongo.bson.buffer, mongo.bson.

Examples

Run this code
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append.time(buf, "Now", Sys.time())
b <- mongo.bson.from.buffer(buf)

Run the code above in your browser using DataLab