[SERVER-1183] Request for an Insert-Only operator Created: 02/Jun/10 Updated: 02/Jun/10 Resolved: 02/Jun/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Michael | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| 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.. |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 02/Jun/10 ] |