[SERVER-5383] wildcard search on cxx driver Created: 16/Jan/12  Updated: 11/Jul/16  Resolved: 10/Apr/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Trivial - P5
Reporter: Khosi Assignee: Kyle Banker
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

64bit, ubuntu 11.10, cxx


Participants:

 Description   

How do I do this (select person from people where name like 'john%'), on the cxx driver?

Currently this is how I achieve my exact matches:-

auto_ptr<mongo::DBClientCursor> cursor =
(*conn).query(NS_INVENTORY, BSON("Name" << name))

Thank you!



 Comments   
Comment by Kyle Banker [ 23/Mar/12 ]

BSONObjBuilder b;
b.appendRegex("Name", "^john", "");
auto_ptr<mongo::DBClientCursor> cursor = (*conn).query(NS_INVENTORY, b.obj());

Generated at Thu Feb 08 03:08:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.