Answer the question
In order to leave comments, you need to log in
How to push only unique objects to an array using Mongoose?
There is a model:
list: [
{
id: { type: Number, required: true, unique: true },
poster: { type: String, required: true },
title: { type: String, required: true },
url: { type: String, required: true },
},
],
Answer the question
In order to leave comments, you need to log in
Set
UPD: I completely forgot about $addToSet
the update request.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question