Description Usage Arguments Value See Also Examples
Return the type of the field currently pointed to by a mongo.bson.iterator.
1 | mongo.bson.iterator.type(iter)
|
iter |
A mongo.bson.iterator. |
(integer) The type of the field pointed to by the iterator as indicated by the following constants:
mongo.bson.eoo – End of Object (0L)
mongo.bson.double
mongo.bson.string
mongo.bson.object
mongo.bson.array
mongo.bson.binary
mongo.bson.undefined
mongo.bson.oid
mongo.bson.bool
mongo.bson.date
mongo.bson.null
mongo.bson.regex
mongo.bson.dbref – deprecated (follow link for more info)
mongo.bson.code
mongo.bson.symbol
mongo.bson.code.w.scope
mongo.bson.int
mongo.bson.timestamp
mongo.bson.long
mongo.bson.iterator,
mongo.bson.iterator.create
,
mongo.bson.find
,
mongo.bson.iterator.next
,
mongo.bson.iterator.key
,
mongo.bson.iterator.value
,
mongo.bson.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | buf <- mongo.bson.buffer.create()
# Append a string
mongo.bson.buffer.append(buf, "name", "Joe")
# Append a date/time
mongo.bson.buffer.append(buf, "created", Sys.time())
# Append a NULL
mongo.bson.buffer.append(buf, "cars", NULL)
b <- mongo.bson.from.buffer(buf)
iter <- mongo.bson.iterator.create(b)
while (mongo.bson.iterator.next(iter))
if (mongo.bson.iterator.type(iter) == mongo.bson.date) {
print(mongo.bson.iterator.value(iter))
break
}
# The above is given for illustrative purposes, but may be performed
# much easier by the following:
iter <- mongo.bson.find(b, "created")
print(mongo.bson.iterator.value(iter))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.