[SERVER-42019] shorthand syntax for checking if _id value is missing Created: 30/Jun/19  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework, Write Ops
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Asya Kamsky Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

In pipeline update specification it is common to check if a field doesn't exist and the way to tell if you're doing an upsert would be to check if _id doesn't exist. I'm proposing a shorthand syntax expression $onInsert or ifUpsert (exact work TBD) which would be short for:

 {$eq:[ {$type:"$_id"}, "missing" ] } 



 Comments   
Comment by Asya Kamsky [ 30/Jun/19 ]

This would be useful the same way $setOnInsert was used in regular update modifiers.

 

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