Skip to content

Commit 3ed0c16

Browse files
committed
no $sampleRate
1 parent 24457f1 commit 3ed0c16

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

internal/verifier/partition.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,18 @@ func (verifier *Verifier) createPartitionTasks(
103103
if sampleRate > 0 && sampleRate < 1 {
104104
pipeline = append(
105105
pipeline,
106-
bson.D{{"$match", bson.D{{"$sampleRate", sampleRate}}}},
106+
bson.D{
107+
{"$match", bson.D{
108+
// This is just $sampleRate, but 4.2 doesn’t recognize
109+
// that, so we write it out:
110+
{"$expr", bson.D{
111+
{"$lt", bson.A{
112+
bson.D{{"$rand", bson.D{}}},
113+
sampleRate,
114+
}},
115+
}},
116+
}},
117+
},
107118
)
108119
}
109120

0 commit comments

Comments
 (0)