this is the query I want to perform:
db['applications'].aggregate(
{$project: {key:1, _id:0}}
,{$group: { _id:null, keyList: {$addToSet:"$key"}}} );
This is the code that I am using:
Aggregation agg = newAggregation(
project("key"),
group("key").addToSet("key").as("keylist")
);
However, the result produced is this:
Executing aggregation:
{ "aggregate" : "applications" , "
pipeline" : [
{ "$project" : { "key" : "$key"}} ,
{ "$group" : { "_id" : "$key" , "keylist" : { "$addToSet" : "$key"}}}
]}
Why is the _id key in the group set to the arguments of 'group'. How do I make it null?
How do i get Spring MongoData to produce the query I want?