[SERVER-17540] Insert support for $currentDate Created: 11/Mar/15  Updated: 16/Mar/15  Resolved: 11/Mar/15

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

Type: New Feature Priority: Minor - P4
Reporter: Shane Gannon Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-13695 Support $currentDate expression for i... Backlog
Participants:

 Description   

The $currentDate operator can only be set by an update action. This is inconvenient when documents need to be created with a $currentDate field.

In my scenario I have an events collection in the database. This collection is populated with events which come from multiple different machines. Each event must be processed in the correct order which is based on the creation date (down to the millisecond). Hence I could not use the local machine time (because the machine clocks could be out of sync) or the ObjectId (whose creation date is limited to seconds). But I can use the servers $currentDate.

I do so at the moment by

  • Adding an event
  • Updating the event with the $currentData
  • Filtering events where the $currentData field does not exist

This works. But the last two steps add additional complexity that "seems" like it could be avoided. i.e. If mongodb supported the insertion of $currentDate.



 Comments   
Comment by Scott Hernandez (Inactive) [ 11/Mar/15 ]

This has already been requested here: SERVER-13695

Please feel free to add a comment to SERVER-13695 if you feel your use-case is different or not included in the existing request.

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