[SERVER-32782] [Change Streams] Make updatedFields queryable for dot-notated fields Created: 18/Jan/18  Updated: 06/Dec/22  Resolved: 20/Jan/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.6.2
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Raphael Londner Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-21889 Oplog format for $set operations on s... Backlog
Related
Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Can we get a fix in the Change Streams generation engine generate updatedFields that are NOT dot-notated?

For instance, instead of

updatedFields: { 'device.temperature': 70}

it would be nice if we could decompose the dot-notated 'device.temperature' string into:

updatedFields: { device: {temperature: 70}}

This is related to SERVER-21889.

I know this might affect the performance of change streams but without that improvement, the use of change streams might turn out to be limited (and restricted to inserts and top-level attributes updates)



 Comments   
Comment by Asya Kamsky [ 20/Jan/18 ]

This ticket will be properly resolved when we fix the query language to allow querying documents which have dotted field names.

Comment by Raphael Londner [ 19/Jan/18 ]

asya you are 100% correct, but I am only suggesting a syntax that would work with change stream $match filters such as { updateDescription.updatedFields.device.temperature: { $gt: 80 }}. To your point, it might be necessary to add an additional flag to differentiate between a 'device.temperature' update and a real {device: {temperature}} one, in order to avoid confusing a listening application.

As I mentioned earlier, we can't rely on the `fullDocument` node of the change stream since it might be out-of-sync with `updatedFields`.

If you have a better suggestion to handle these filter queries, please feel free to recommend one.

Comment by Asya Kamsky [ 19/Jan/18 ]

raphael.londner the second format is 100% not equivalent to the first format.

updatedFields: { device: {temperature: 70}}

means that device is now exactly a subdocument with one field: "temperature". The dotted notation means that temperature is now 70, other fields are not affected.

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