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