@@ -131,6 +131,12 @@ void queryGeoData(DBClientBase* conn) {
131131 Query q5 = MONGO_QUERY (kLocField << WITHINQUERY (poly.getBoundingBox ()));
132132 Query q6 = MONGO_QUERY (kLocField << INTERSECTSQUERY (poly));
133133
134+ geo::Coordinates2DGeographic coords (1 , 2 );
135+ geo::coords2dgeographic::Point point (coords);
136+
137+ Query nearQuery = MONGO_QUERY (kLocField << NEARQUERY (point, 0.5 ));
138+ Query nearSphereQuery = MONGO_QUERY (kLocField << NEARSPHEREQUERY (point, 0.5 ));
139+
134140 cout << " *** Testing LineString ***" << endl;
135141
136142 auto_ptr<DBClientCursor> cursor = conn->query (kDbCollectionName , q);
@@ -173,6 +179,18 @@ void queryGeoData(DBClientBase* conn) {
173179 cout << cursor6->next ().toString () << endl;
174180 cout << " ---------------" << endl;
175181
182+ auto_ptr<DBClientCursor> nearQueryCursor = conn->query (kDbCollectionName , nearQuery);
183+ cout << " Results from NEAR" << endl;
184+ while (nearQueryCursor->more ())
185+ cout << nearQueryCursor->next ().toString () << endl;
186+ cout << " ---------------" << endl;
187+
188+ auto_ptr<DBClientCursor> nearSphereQueryCursor = conn->query (kDbCollectionName , nearSphereQuery);
189+ cout << " Results from NEARSPHERE" << endl;
190+ while (nearSphereQueryCursor->more ())
191+ cout << nearSphereQueryCursor->next ().toString () << endl;
192+ cout << " ---------------" << endl;
193+
176194}
177195
178196int main ( int argc, const char **argv ) {
0 commit comments