Description Details See Also Examples
Objects of class "mongo.timestamp" are an extension of the POSIXct class. They have their increment value stored in the "increment" attribute of the object.
See http://www.mongodb.org/display/DOCS/Timestamp+Data+Type
mongo.timestamp objects have "mongo.timestamp", "POSIXct" & "POSIXt" as
their class so that mongo.bson.buffer.append()
may detect them
and append the appropriate BSON code-typed value to a buffer.
These mongo.timestamp values may also be present in a list and will be
handled properly by mongo.bson.buffer.append.list()
and
mongo.bson.from.list()
.
mongo.timestamp.create
,
mongo.bson.buffer.append
,
mongo.bson.buffer.append.list
,
mongo.bson.buffer,
mongo.bson.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | mongo <- mongo.create()
if (mongo.is.connected(mongo)) {
buf <- mongo.bson.buffer.create()
# special Null timestamp -- automatically filled in
# if one of first two fields in a record
ts <- mongo.timestamp.create(0,0)
mongo.bson.buffer.append(buf, "InsertTime", ts)
mongo.bson.buffer.append(buf, "name", "Joe")
b <- mongo.bson.from.buffer(buf)
mongo.insert(mongo, "test.people", b)
# create using a POSIXlt
ts <- mongo.timestamp.create(strptime("05-12-2012",
"%m-%d-%Y"), increment=1)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.