[DOCS-13885] Investigate changes in SERVER-48474: Add $sampleRate match expression Created: 18/Sep/20  Updated: 13/Nov/23  Resolved: 07/Dec/20

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.7.0, 4.4.2, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Dave Cuthbert (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-48474 Add $sampleRate match expression Closed
Participants:
Days since reply: 3 years, 9 weeks, 2 days ago
Epic Link: DOCSP-9747
Story Points: 3

 Description   

Description

Downstream Change Summary

We added a new expression, $sampleRate, which lets you select a desired fraction or percentage of documents. (Contrast with $sample, which lets you select a desired number of documents.)

Description of Linked Ticket

This match expression takes a floating point number between 0 and 1 (both inclusive) with 0 matching nothing and 1 matching all. It desugars to {$expr: {$rand: ...}}

Unlike $sample, which is an experession, $sampleRate is a match-expression, which can go inside .find() or {$match: _}.

For example, the pipeline:

{$match: {$sampleRate: 0.25}}

Would select on average 1/4 of the input documents. It could desugar to

{$match: {$expr: {$lt: [ {$rand: {}}, 0.25 ]}}}

Scope of changes

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)



 Comments   
Comment by Githook User [ 07/Dec/20 ]

Author:

{'name': 'Dave Cuthbert', 'email': 'dave.cuthbert@mongodb.com', 'username': 'davemungo'}

Message: DOCS-13885 add sampleRate match operator
Branch: master
https://github.com/mongodb/docs/commit/e41f0672216728d3c97a955ad8200f77767bb918

Comment by Githook User [ 07/Dec/20 ]

Author:

{'name': 'Dave Cuthbert', 'email': 'dave.cuthbert@mongodb.com', 'username': 'davemungo'}

Message: DOCS-13885 add sampleRate match operator
Branch: v5.0
https://github.com/mongodb/docs/commit/8ecdbeb63adac93b9c45abb9b33375636baf8f2d

Comment by Jeffrey Allen [ 09/Nov/20 ]

Hey steve.renaker, Dave worked on a related ticket last week so I'm going to give this one over to him.

Generated at Thu Feb 08 08:08:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.