Learn R Programming

rmongodb (version 1.8.0)

mongo.symbol: The mongo.symbol class

Description

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

Arguments

Details

mongo.symbol objects' value is a string representing the value of the symbol.

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

These mongo.symbol 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.symbol.create, mongo.bson.buffer.append, mongo.bson.buffer.append.list, mongo.bson.buffer, mongo.bson.

Examples

Run this code
buf <- mongo.bson.buffer.create()
sym <- mongo.symbol.create("Beta")
mongo.bson.buffer.append(buf, "B", sym)
l <- list(s1 = sym, Two = 2)
mongo.bson.buffer.append.list(buf, "listWsym", l)
b <- mongo.bson.from.buffer(buf)

# the above will create a mongo.bson object of the following form:
# { "B": (SYMBOL) "Beta",
#   "listWsym" : { "s1" : (SYMBOL) "Beta",
#                  "Two" : 2 } }

Run the code above in your browser using DataLab