When using MongoSamplePartitioner with a custom partitionKey , partition boundaries are matching partitionKey but values are set to ObjectId values:
{ "$match" : { "identifier" : { "$gte" : ObjectId("584cc388809ba8325a6df908"), "$lt" : ObjectId("586f76d3809ba8325a82186f") } } }
The problem looks to be in MongoSamplePartitioner.scala:99, value field key is set to "_id" , but should be partitionKey:
samples.zipWithIndex.collect { case (field, i) if i % samplesPerPartition == 0 => field.get("_id") }