MongoDb: Difference between $push/$addtoset

后端 未结 6 688
迷失自我
迷失自我 2020-12-08 09:06

I read the documentation in the MongoDb and I used a simple proves and I only look that: Push is sorting the array but addtoSet isn\'t it.

For me visual

6条回答
  •  感动是毒
    2020-12-08 09:30

    As the name suggest $addToSet (set) wont allow duplicates while $push simply add the element to array

提交回复
热议问题