Learn R Programming

rmongodb (version 1.8.0)

mongo.regex: The mongo.regex class

Description

Objects of class "mongo.regex" represent regular expressions and are strings with the options value stored in the "options" attribute.

Arguments

Details

See http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-RegularExpressions

mongo.regex objects have "mongo.regex" as their class so that mongo.bson.buffer.append() may detect them and append the appropriate BSON regex-typed value to a buffer.

These mongo.regex values may also be present in a list and will be handled properly by mongo.bson.buffer.append.list() and mongo.bson.from.list().

See Also

mongo.regex.create, mongo.bson.buffer.append, mongo.bson.buffer.append.list, mongo.bson.buffer, mongo.bson.

Examples

Run this code
buf <- mongo.bson.buffer.create()
regex <- mongo.regex.create("acme.*corp", options="i")
mongo.bson.buffer.append.regex(buf, "MatchAcme", regex)
b <- mongo.bson.from.buffer(buf)

Run the code above in your browser using DataLab