Description Usage Arguments Details Value See Also Examples
Append a javascript code value with a scope object onto a mongo.bson.buffer.
1 | mongo.bson.buffer.append.code.w.scope(buf, name, value)
|
buf |
(mongo.bson.buffer) The buffer object to which to append. |
name |
(string) The name (key) of the field appended to the buffer. |
value |
mongo.code.w.scope The scoped javascript code. |
BSON has a special field type to indicate javascript code with a scope. This function appends such an indicator as the type of a field with its value.
TRUE if successful; otherwise, FALSE if an error occured appending the data.
mongo.code.w.scope,
mongo.code.w.scope.create
,
mongo.bson.buffer.append
,
mongo.bson.from.list
,
mongo.bson.buffer,
mongo.bson.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | scope <- mongo.bson.from.list(list(scopevar="scopevalue"))
buf <- mongo.bson.buffer.create()
codeWscope <- mongo.code.w.scope.create("y = x", scope)
mongo.bson.buffer.append.code.w.scope(buf, "CodeWscope1",
codeWscope)
# mongo.bson.buffer.append() will give the same result
# as it can detect the mongo.code.w.scope object
mongo.bson.buffer.append(buf, "CodeWscope2", codeWscope)
b <- mongo.bson.from.buffer(buf)
# The above produces a BSON object of the form:
# { "CodeWscope1" : (CODEWSCOPE) "y = x"
# (SCOPE) { "scopevar" : "scopevalue" },
# "CodeWscope2" : (CODEWSCOPE) "y = x"
# (SCOPE) { "scopevar" : "scopevalue" } }
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.