Learn R Programming

rmongodb (version 1.8.0)

mongo.symbol.create: Create a mongo.symbol object

Description

Create a mongo.symbol object for appending to a buffer with mongo.bson.buffer.append() or for embedding in a list such that mongo.bson.buffer.append.list() will properly insert a symbol value into the mongo.bson.buffer object.

Usage

mongo.symbol.create(value)

Arguments

value
(string) The value of the symbol

Value

a mongo.symbol object

See Also

mongo.symbol, 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("Alpha")
mongo.bson.buffer.append(buf, "A", sym)
lst <- list(s1 = sym, One = 1)
mongo.bson.buffer.append.list(buf, "listWsym", lst)
mongo.bson.buffer.append.symbol(buf, "D", "Delta")
b <- mongo.bson.from.buffer(buf)

# the above will create a mongo.bson object of the following form:
# { "A": (SYMBOL) "Alpha",
#   "listWsym" : { "a1"  : (SYMBOL) "Aplha",
#                  "One" : 1 },
#   "D" : (SYMBOL) "Delta" }

Run the code above in your browser using DataLab