---
title: "Discussion on \"MongoDB - Prevent duplication in your arrays\" | Hashnode"
description: "Discussion on \"MongoDB - Prevent duplication in your arrays\". $push vs $addToSet"
url: "https://hashnode.com/posts/mongodb-prevent-duplication-in-your-arrays/6669bc8882e12176647f6901"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [MongoDB - Prevent duplication in your arrays](https://blog.etheve.eu/mongodb-prevent-duplication-in-your-arrays?utm_source=hashnode&utm_medium=feed)

$push vs $addToSet

Jun 12, 2024 · 1 min read · blog.etheve.eu  
Updated Jun 28, 2024  
Read the article

-   [#mongodb](https://hashnode.com/tag/mongodb)
-   [#mongoose](https://hashnode.com/tag/mongoose)
-   [#array](https://hashnode.com/tag/array)
-   [#data-duplication](https://hashnode.com/tag/data-duplication)

## Written by

[Guileas](https://hashnode.com/@Guileas)

@Guileas

  
[View profile](https://hashnode.com/@Guileas)

Non stop learning

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
