Description Details See Also Examples
Objects of class "mongo.code.w.scope" are used to represent javascript code values with scopes in BSON documents.
mongo.code.w.scope objects' value is a string representing the value of the code.
The scope is a mongo.bson object and is stored in the "scope" attribute of the mongo.code.w.scope object.
mongo.code.w.scope objects have "mongo.code.w.scope" as their class so
that
mongo.bson.buffer.append()
may detect them and append
the appropriate BSON code-typed value and scope to a buffer.
These mongo.code.w.scope values may also be present in a list and will be
handled properly by mongo.bson.buffer.append.list()
and
mongo.bson.from.list()
.
mongo.code.w.scope.create
,
mongo.bson.buffer.append
,
mongo.bson.buffer.append.list
,
mongo.bson.buffer,
mongo.bson.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | buf <- mongo.bson.buffer.create()
mongo.bson.buffer.append(buf, "sv", "sx")
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)
lst <- list(c1 = codeWscope, One = 1)
mongo.bson.buffer.append.list(buf, "listWcodeWscope", lst)
b <- mongo.bson.from.buffer(buf)
# the above will create a mongo.bson object of the following form:
# { "CodeWscope" : (CODEWSCOPE) "y = x"
# (SCOPE) { "sv" : "sx"},
# "listWcodeWscope" : { "c1" : (CODEWSCOPE) "y = x"
# (SCOPE) { "sv" : "sx"} } }
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.