Use `collection.updateOne({id}, {$addToSet: {pictures: picture}}, {upsert: true});`, why do I have two pieces of data with the same id in my database?

I use collection.updateOne({id}, {$addToSet: {pictures: picture}}, {upsert: true}); to update existed data based on id or insert the data, but I found two pieces of data with the same id in my database.I expect that when I find that there is already data for this id, I will update the data instead of adding it.
Is it caused by concurrent requests?

app.get('/aaa', async (req, res) => {
    await client.connect();
    const {id, picture} = req.query;
    const collection = client.db('abc').collection('bcd');
    await collection.updateOne({id}, {$addToSet: {pictures: picture}}, {upsert: true});
useEffect(() => {
}, []);

I tested it with the demo above and it didn’t work.