
Last chance! 50% off unlimited learning
Sale ends in
mongo.bson.buffer.append()
or for embedding in a list such
that mongo.bson.buffer.append.list()
will properly insert a
code value into the mongo.bson.buffer object.
mongo.code.w.scope.create(code, scope)
mongo.bson.buffer.append
,
mongo.bson.buffer.append.list
, mongo.bson.buffer,
mongo.bson.
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append(buf, "scopevar", "scopevalue")
scope <- mongo.bson.from.buffer(buf)
codeWscope <- mongo.code.w.scope.create("y = x", scope)
buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append(buf, "CodeWscope", codeWscope)
b <- mongo.bson.from.buffer(buf)
# The above produces a BSON object of the form:
# { "CodeWscope" : (CODEWSCOPE) "y = x"
# (SCOPE) { "scopevar" : "scopevalue" } }
Run the code above in your browser using DataLab