Announcement Announcement Module
No announcement yet.
Mongo Document Format Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mongo Document Format

    Hi is it possible to Group by array contents? I have been stuck for some time trying all manner of things.

    public class Record {
    	private RecordKey RecordKey;
            private Date recordTimestamp;
    	private List<String> contributors = new ArrayList<String>();
            private List<MongoString> languages = new ArrayList<MongoString>();
    public class MongoString implements Serializable {
    	private static final long serialVersionUID = 9042077321090421097L;
    	private String value = null;
    // Few of my attempts..."languages", GroupBy.key("value").initialDocument("{ count: 0 }").reduceFunction("function(doc, prev) { prev.count++; }"), XObject.class);"record", GroupBy.key("languages").initialDocument("{ count: 0 }").reduceFunction("function(doc, prev) { prev.count++; }"), XObject.class);
    I am trying to group by the distinct values in the arrays rather than the actual distinct arrays. I have tried DbRef custom objects etc. They are of an undetermined size so need to be a collection of some sort. I also had a go with map reduce also but that was as much of a success.

    It does appear to be a function of MongoDB
    Last edited by msduk; Mar 22nd, 2012, 08:43 PM.