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

Request for an Insert-Only operator

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      It would be nice to have some sort of insert-only operator. The upsert feature is very robust but being able to insert some document if and only if it doesn't exist (as defined by some selector field(s)) would be very useful.

      something like:

      db.items.insert_only(

      {unique_id:1234}

      ,

      {value: 'a'}

      )

      would only insert this document if no item exists with a 'unique_id' of 1234.

      With a traditional RDBMS, one would do a SELECT to determine if it exists then an INSERT if doesn't exist. Wrapping those statements in a transactions would make the entire operation atomic.

      Just a suggestion..

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            jedi-bob Michael
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: