Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query Azure DocumentDB with an equivalent of the SELECT DISTINCT statement

DocumentDb don't support the DISTINCT statement. I have documents in DocumentDB with the following structure (thousands of documents):

{
    "type" : "type1",
    "data" : {
        ...
    }
},{
    "type" : "type2",
    "data" : {
        ...
    }
},{
    "type" : "type2",
    "data" : {
        ...
    }
},{
    "type" : "type2",
    "data" : {
        ...
    }
}

How can I query the collection and get the following result:

{
    "type" : "type1"
},{
    "type" : "type2"
}
like image 989
aludvigsen Avatar asked Nov 14 '14 11:11

aludvigsen


1 Answers

Azure DocumentDB currently does not support DISTINCT.

Please voice your opinion and vote for this feature on DocumentDB's feedback forum.

like image 182
Andrew Liu Avatar answered Oct 30 '22 00:10

Andrew Liu