草庐IT

BSONArrayBuilder

全部标签

c++ - 在 BSONArrayBuilder 中包含正则表达式元素

BSONArrayBuilderclass在MongoDBC++驱动程序API中允许构建BSON数组,例如。BSONArrayBuilderba;ba.append("foo");ba.append("bar");...connection->query("col",BSON("x"将在mongoshell中执行如下查询:db.col.find({"x":{"$in":["foo","bar"]}})但是,我需要按照以下方式(适用于mongoshell)基于正则表达式而不是字符串进行查询:db.col.find({"x":{"$in":[/^foo/,/^bar/]}})如何使用C++