diff options
| author | Antonin Kral <a.kral@bobek.cz> | 2011-06-18 21:24:41 +0200 |
|---|---|---|
| committer | Antonin Kral <a.kral@bobek.cz> | 2011-06-18 21:24:41 +0200 |
| commit | 64b33ee522375a8dc15be2875dfb7db4502259b0 (patch) | |
| tree | 44979e0aaf6bb576f4a737a93e071e28809b6779 /client/examples/clientTest.cpp | |
| parent | 4d87ff4aa74d7ae975268ac43eee152dc3f5b7e9 (diff) | |
Imported Upstream version 1.8.2upstream/1.8.2
Diffstat (limited to 'client/examples/clientTest.cpp')
| -rw-r--r-- | client/examples/clientTest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/client/examples/clientTest.cpp b/client/examples/clientTest.cpp index bd4432eb0cf..96c014e245c 100644 --- a/client/examples/clientTest.cpp +++ b/client/examples/clientTest.cpp @@ -224,5 +224,27 @@ int main( int argc, const char **argv ) { } } + { + //Map Reduce (this mostly just tests that it compiles with all output types) + const string ns = "test.mr"; + conn.insert(ns, BSON("a" << 1)); + conn.insert(ns, BSON("a" << 1)); + + const char* map = "function() { emit(this.a, 1); }"; + const char* reduce = "function(key, values) { return Array.sum(values); }"; + + const string outcoll = ns + ".out"; + + BSONObj out; + out = conn.mapreduce(ns, map, reduce, BSONObj()); // default to inline + //MONGO_PRINT(out); + out = conn.mapreduce(ns, map, reduce, BSONObj(), outcoll); + //MONGO_PRINT(out); + out = conn.mapreduce(ns, map, reduce, BSONObj(), outcoll.c_str()); + //MONGO_PRINT(out); + out = conn.mapreduce(ns, map, reduce, BSONObj(), BSON("reduce" << outcoll)); + //MONGO_PRINT(out); + } + cout << "client test finished!" << endl; } |
