Show
Example:
Input:
db.coffee.insertMany( [
{
"altitude" : 600 ,
"variety" : "Arabica Typica" ,
"health" : 68.3
},
{
"altitude" : 600 ,
"variety" : "Gesha" ,
"health" : 90.2
},
{
"altitude" : 700 ,
"variety" : "Arabica Typica" ,
"health" : 69.5
},
{
"altitude" : 700 ,
"variety" : "Gesha"
},
{
"altitude" : 800 ,
"variety" : "Arabica Typica"
},
{
"altitude" : 800 ,
"variety" : "Gesha" ,
"health" : 86.9
},
{
"altitude" : 900 ,
"variety" : "Arabica Typica" ,
"health" : 72.5
},
{
"altitude" : 900 ,
"variety" : "Gesha"
},
{
"altitude" : 1000 ,
"variety" : "Arabica Typica" ,
"health" : 73.0
},
{
"altitude" : 1000 ,
"variety" : "Gesha" ,
"health" : 80.4
},
] )
Aggregation:
db.coffee.aggregate([
{
$fill:
{
sortBy: { altitude: 1 },
partitionBy: "$variety" ,
output:
{
"health" : { method: "linear" }
}
}
}
])
Errors with this output:
BSON field '$fill.partitionBy' is the wrong type 'string' , expected type 'object'
The expectation is that this aggregation would successfully partition the data by the two coffee varieties.