Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9039

Enhancement of Server Side Created MongoTimestamp (0 filled)

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:

      Description

      MongoDB has built in an incredible 'feature' that, if enhanced just a little bit, would take things to the next level for us. It seems the MongoTimestamp that is created server-side by sending with 0-value seems to be thought of only as an 'internal' feature used for Replication/Oplog. But for us, this has become the staple of our entire API platform. It really is one of the best things about Mongod...being able to insert this unique timestamp_inc is extremely powerful for anyone trying build a system that supports polling of inserted/updated records (get what is new/changed since XYZ).

      However...the limitation of having it only work on 1 field, and also only work during entire 'update' is tough to overcome.

      Here is what I would like to see as an enhancement:

      1) Inserting the 0-valued timestamp should continue to work as is, but we should be able to do this for more than 1 field. Even if you only supported 2 fields that would be FANTASTIC! For example, if I put 0-valued timestamps in first 2 fields, I want them both marked with the same timestamp_inc. If you are wondering why I need this, it provides capacity to mark a unique 'creation' timestamp_increment as well as a 'updated' timestamp_increment. In case of insertion, they should be the same. During an update, we restamp the 'updated' field.

      Having both means that doing polling queries for any records 'updated' or 'created' since [timestamp_inc] can be done with a single query on 'updated' gte [timestamp_inc]. As it is now, we have to do 2 queries, merge the results, and sort & limit with code, which takes all the fun out of it :}. The other option we have tried is to insert the record, then immediately retrive it, and update it again saving the 'updated' timestamp_inc with the value in 'created'---also a really miserable thing to have to be doing.

      2) Make it possible to do a $set on a document with the 0-valued timestamp to update field with server timestamp_inc.

      These 2 items, i've been wanting since 2010--- see other ticket. https://jira.mongodb.org/browse/SERVER-1650 I made this new ticket because I think the other one isn't quite clear enough.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: