final MongoCollection<Document> nodesCollection = mongoDatabaseOneDms.getCollection("nodes");
BsonDocument keys = new BsonDocument("className", new BsonString("it.document"));
BsonDocument condition = new BsonDocument("stats", new BsonDocument("$exists", new BsonInt32(1))); BasicDBObject initial = new BasicDBObject("totDownload", 0).append("totView", 0).append("totEle", 0);BsonJavaScript reduceFunction = new BsonJavaScript("function(curr,result){}");
//THIS IS THE CAOS....
SingleServerBinding ss = new SingleServerBinding(null, null);
Codec<BsonDocument> decoder = new BsonDocumentCodec();
?? = new GroupOperation(nodesCollection, reduceFunction, Codec (????) ).key(keys).filter(condition).execute(ss);
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/8b71fb20-87b2-4c5f-8c5a-69a247265079%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi.
This is the script.
db.nodes.group(
{key : {'className':'it.marcoberri.Document'},
cond:{"stats" : {"$exists":1}},
reduce : function(curr, result){
if(curr.stats.downloads)
result.totDownload += curr.stats.downloads;
if(curr.stats.views)
result.totView += curr.stats.views;
result.totEle++;
},
initial : {totDownload : 0, totView : 0, totEle :0}}
);
I would try the .group function in java.
Tnx.
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/kPPt_-ygY9w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAOjLY%2BH2PDcx52YJZFiZFnV84D7u1vr891RdoVGmwK66uF5uOw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/kPPt_-ygY9w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/8bd9d29a-8e73-4f30-a343-e691a36fcdb6%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CA%2Beu9MVuZ0PrWyb7b1dcxn970ktJpH0zqQdyk%2B4pC7-f43ARRw%40mail.gmail.com.