Aggregation & Rogue

40 views
Skip to first unread message

Roch Delsalle

unread,
Mar 14, 2013, 8:51:44 AM3/14/13
to rogue...@googlegroups.com
Hi,

I would like to know if its possible to use MongoDB aggregations via Rogue ?
I'm currently setting up a small list with filters and I'm trying to do it without using ElasticSearch / Facets since its a small project.

Best,

Roch

Jason Liszka

unread,
Mar 15, 2013, 12:15:45 PM3/15/13
to rogue...@googlegroups.com
No, sorry, full aggregations are not supported yet. Only count and distinct so far. Pull requests welcome!

But if you give some more details about what you're trying to do, perhaps I can suggest a way to do it without aggregations.


--
You received this message because you are subscribed to the Google Groups "rogue-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rogue-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Roch Delsalle

unread,
Mar 19, 2013, 6:09:31 AM3/19/13
to rogue...@googlegroups.com
Hi Jason,

Thank you for your answer,
I did it using the basic MongoDB library :

var items = MongoDB.use(DefaultMongoIdentifier) { db =>
    var collection = db.getCollection("products")
    var cmd = new GroupCommand(collection,
      new BasicDBObject("brand", 1),
      null,
      new BasicDBObject("count", 0),
      "function ( curr, result ) {result.count++}",
      null);
    implicit val formats = net.liftweb.json.DefaultFormats
    JObjectParser.serialize(collection.group(cmd))
  }

Then I can map the values to a list of Brand objects.

Roch
Reply all
Reply to author
Forward
0 new messages