[SERVER-3174] Allows $inc for Date Created: 01/Jun/11  Updated: 06/Dec/22  Resolved: 29/Jun/19

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Backlog - Query Team (Inactive)
Resolution: Won't Do Votes: 40
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-22903 $inc operator ISO date in mongodb Closed
Assigned Teams:
Query
Participants:

 Description   

Allows using some expression to update an existing Date, or set it. It would good to be able to update in different increments (seconds, minutes, days, months, years...)



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

SERVER-40381 implemented support for aggregation expressions to specify update for 4.2. 

You can see some examples here.

This can be done by setting date using $add expression with date and interval in milliseconds.

db.c.update({}, [
      {$set:{date:{
            $add:[ "$date",  2*24*60*60*1000 ]      // add 2 days expressed in millis
      }}}
]);

Comment by Chris Kuethe [ 19/Jun/17 ]

Any idea when this is going to be looked at?

Comment by Raghu Katti [ 26/Apr/13 ]

We are looking for this feature as well. Any plans to add it ?

Raghu
http://www.paywithglyph.com

Comment by Fredrik Björk [ 16/Apr/13 ]

Any plans on adding this?

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