0

Having a document with this format :

"_id" : ObjectId("59ce3bb32708c95ee2168e2f"),
    "document1" : [ 
        {
            "value" : "doc1A"
        }, 
        {
            "value" : "doc1B"
        }, 
        {
            "value" : "doc1C"
        }, 
        {
            "value" : "doc1D"
        }, 
        {
            "value" : "doc1E"
        }, 
        {
            "value" : "doc1F"
        }
    ],
    "document2" : [ 
        {
            "value" : "doc2A"
        }, 
        {
            "value" : "doc2B"
        }, 
        {
            "value" : "doc2C"
        }, 
        {
            "value" : "doc2D"
        },
        "metric1" :0.0,
        "metric2" : 0.0 
    ]

}

I need to group by the concatenation of the document1 and document 2 values and perform some calculs on it in Aggregation framework at Java.

I can do group(document1,document2) but I'll get as an _id an array so I want to get it as a concatenation and as :

 doc1A (doc2A) / doc1A (doc2B) / doc1A (doc2C) ...

Do you have any idea ?

Dr. Mza
  • 171
  • 1
  • 11
  • Not clear enough. Can you show us the output in the json format ? – s7vr Jan 02 '18 at 13:27
  • and what do you expect to get if document1 and document2 have different number of array elements? – Asya Kamsky Jan 02 '18 at 22:28
  • I want to get all the combinaisons possible between document1 and document 2, for this example I should have 24 combinaisons of documentX(documentY), between () is the element of document 2. – Dr. Mza Jan 03 '18 at 00:38

0 Answers0