mongodb Official $addToSet does not guarantee a particular ordering of elements in the modified set., but i test $addToSet element result is insert order, i can not comprehend $addToSet does not guarantee a particular ordering of elements in the modified set
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/42662b88-b2ab-4720-8f6f-c7d5fd4a7cd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CALKyTE6BQg2Rdpe-kjtxt690sY0sTKOUPPoZy86M5iPba2GAqw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CABirCh-spcYO8f6Ez4r-73ops8ZZt5F_6DRdxAo-sckg5nt_dQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CALKyTE4DUzD4ySwWfxO%2BS7oomUxbuOH7RQer%2Bz7K9eXRQ_8now%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CABirCh9%3DtXmcv%2B62eZTNk%3D%2BgGh2rCKFWe%2BUM%3DTiwW6jEH8bVFQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CALKyTE6ZpXkQ_2rY9FxVZkOsM3hGMV96yn-fjDJ9exhEJA0viQ%40mail.gmail.com.
I'm not sure what you're asking, but it's the source (and live testing) that I'm looking at. https://github.com/Tokutek/mongo/blob/master/src/mongo/db/ops/update_internal.cpp#L251 This code appears to only ever append to the array and never changes the order of existing elements, which means the documentation is incorrect. I could be missing something in the code.
I believe the documentation sets expectations correctly -- a "guarantee" implies a commitment to testing and supporting a specific behaviour. While the current $addToSet implementation may add elements in a predictable fashion, there is no guarantee that this undocumented behaviour will remain consistent between releases. I would also point out that you are looking at the source for the TokuMX fork; they may choose to deviate on their internal implementations ;-).
The typical notion of a set is an unordered list of items with no duplicates: http://en.wikipedia.org/wiki/Set_(abstract_data_type).
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CABirCh8i_Nd0svAUUH-9%3DxAqNtryvoQET6pXkuZ09tFk4eCzRA%40mail.gmail.com.