[SERVER-2249] $addToSet with $each doesn't check uniqueness for new elements Created: 19/Dec/10 Updated: 12/Jul/16 Resolved: 19/Dec/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 1.7.3 |
| Fix Version/s: | 1.7.4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | David Cuadrado | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
linux ubuntu 10.10 |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
------------------------------------------------------------------------------ require 'mongo' db = Mongo::Connection.new.db('sample-db') coll.insert({:_id => "test_add_to_set", :arr => []}) puts coll.find({:_id => "test_add_to_set"}).next_document.inspect $ ruby test_case.rb {"_id"=>"test_add_to_set", "arr"=>[1, 1, 2, 3]}------------------------------------------------------------------------------ for some reason the value(1) in the array is repeated is this a bug? or am I doing something wrong? |
| Comments |
| Comment by auto [ 19/Dec/10 ] |
|
Author: {u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}Message: fix case where the same element is in $each part of $addToSet |
| Comment by Scott Hernandez (Inactive) [ 19/Dec/10 ] |
|
It looks like a bug. Here is a simpler repro. > db.t.save({_id:1}) |