Description Usage Arguments Details Value See Also Examples
Find a field within a mongo.bson object by the name (key) of the
field
and return a mongo.bson.iterator pointing to that field.
1 | mongo.bson.find(b, name)
|
b |
(mongo.bson) The object in which to find the field. |
name |
(string) The name of the field to find. |
The search parameter may also be a 'dotted' reference to a field in a subobject or array. See examples.
(mongo.bson.iterator) An iterator pointing to the field found if name was found among the names of the fields; otherwise, NULL.
mongo.bson.iterator,
mongo.bson.iterator.value
,
mongo.bson.
1 2 3 4 5 6 7 8 9 10 11 12 | b <- mongo.bson.from.list(list(name="John", age=32L,
address=list(street="Vine", city="Denver", state="CO")))
iter <- mongo.bson.find(b, "age")
print(mongo.bson.iterator.value(iter)) # print 32
iter <- mongo.bson.find(b, "address.city")
print(mongo.bson.iterator.value(iter)) # print Denver
x <- c(1,1,2,3,5)
b <- mongo.bson.from.list(list(fib=x))
iter <- mongo.bson.find(b, "fib.3") # BSON arrays are 0-based
print(mongo.bson.iterator.value(iter)) # print 3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.