$or operator from mongoose not providing all necessary data when used with the find() Method

I am using the find method alongside with the $or operator to check the database for any existing duplicate data in this line const duplicate = await NewItemsData.find({ $or: newItems }); checking the variable in the consoleconsole.log(duplicate) I discovered that some data gotten are missing. Here is the code:

please help me out to know where this problem is coming from. The aim of the code is to create an array containing duplicate data, then filter the newItems array creating another array that contains data existing in the newItems array but not in the duplicates array.

const createMoneyInTransact = asyncHandler(async (req, res) => {
 const {newItems}= req.body
 console.log(newItems)

//check the database to see if any data found in the newItems array coming in from the frontend
//already exists in the NewItemsData database if it exists, create a new array of all duplicates

  const duplicate = await NewItemsData.find({ $or: newItems });
  console.log(duplicate)
     if(Array.isArray(duplicate) && duplicate.length === 0){
        console.log('no duplicates')
         const create_newItems = await NewItemsData.create(newItems)
       console.log(create_newItems)
    }else{
        console.log('duplicate exists')
        //helper function that compares two objects in arrays by their properties
    const containsObject=(obj, arr, key)=>{
        return arr.some((element)=>{
            return element[key] === obj[key]
        })

     }

     // Filter the newItems array and keep only the objects that are 
     //not in the duplicate array
     const newUniqueItems = newItems.filter((obj)=>{
         return !containsObject(obj, duplicate, 'productName')
     })

     console.log(newUniqueItems)
     const create_newUniqueItems = await NewItemsData.create(newUniqueItems)
     console.log(create_newUniqueItems)

    }
})


//console.log Data
//console.log(newItems) displays the result below
[
  {
    productName: 'vally',
    sellingPriceOfTotal: 3619,
    quantityCount: 11,
    unitOfQuantity: 'grams',
    sellingPrice: '329'
  },
  {
    productName: 'Tridant',
    sellingPriceOfTotal: 2400,
    quantityCount: 4,
    unitOfQuantity: 'grams',
    sellingPrice: '600'
  },
  {
    productName: 'trulia',
    sellingPriceOfTotal: 1600,
    quantityCount: 4,
    unitOfQuantity: 'kg',
    sellingPrice: '400'
  },
  {
    productName: 'constr',
    sellingPriceOfTotal: 1362,
    quantityCount: 3,
    unitOfQuantity: 'kg',
    sellingPrice: '454'
  }
]
//console.log(duplicate) displays the result below
[
  {
    _id: new ObjectId("6598d46d37efd2db72ee9ecd"),
    productName: 'Tridant',
    sellingPriceOfTotal: '2400',
    quantityCount: 4,
    unitOfQuantity: 'grams',
    sellingPrice: 600,
    __v: 0
  },
  {
    _id: new ObjectId("6599150ebd9fedd3f0b9e721"),
    productName: 'trulia',
    sellingPriceOfTotal: '1600',
    quantityCount: 4,
    unitOfQuantity: 'kg',
    sellingPrice: 400,
    __v: 0
  }
]

//productName: vally was surposed to be among the duplicate but was not picked up
//console.log(newUniqueItems) displays the result below
[
  {
    productName: 'vally',
    sellingPriceOfTotal: '3619',
    quantityCount: 11,
    unitOfQuantity: 'grams',
    sellingPrice: 329
  },
  {
    productName: 'constr',
    sellingPriceOfTotal: '1362',
    quantityCount: 3,
    unitOfQuantity: 'kg',
    sellingPrice: 454
  }
]
//but vally is not supposed to be among the filtered array because it is a duplicate hence
//the errow message below

MongoServerError: E11000 duplicate key error collection: test.newitemsdatas index: productName_1 dup key: { productName: "vally" }
    at C:UsersUSERDesktopbussiness-booksservernode_modulesmongodbliboperationsinsert.js:50:33
    at C:UsersUSERDesktopbussiness-booksservernode_modulesmongodbliboperationscommand.js:84:64
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

//here is the NewItemsData Data Model
const mongoose = require('mongoose');
const MoneyInData = require('./MoneyInData');

const newItemsSchema = new mongoose.Schema({

    productName:{
        type: String,
        required: true,
        unique: true
    },
    sellingPriceOfTotal:{
      type: String,
      //required: true
    },
    quantityCount: {
        type: Number,
    },
    unitOfQuantity:{
        type: String,
    },
    costPrice:{
      type: Number,
      //required: true
    },
    sellingPrice:{
        type: Number,
       required:true
    },
    moneyInData:{
        type: mongoose.Schema.Types.ObjectId,
        ref: 'MoneyInData'
    },

})

module.exports = mongoose.model('NewItemsData', newItemsSchema);