Criterion in bulkupdate

Question:
hello, I would like to benefit (very quickly) from your knowledge and your mutual assistance.
I would now like to perform a bulkupdate as done previously with bulk remove.
The result i wish : check a boolean => True for all elements of my “personalCart” database (criterion: the same email address) (The code in attachment)

Product:
wix Editor

What are you trying to achieve:
update multiple fields withe the same mail
Capture d'écran 2024-10-03 094656

THANKS A LOT…

Hi, user3373 !!

You need to include an options object as the third argument for bulkUpdate , but in your case, an array is being passed instead, which is likely causing the error. :thinking:

There are several other parts that could be improved, but for now, please try making the changes like this.


const updatedData = data.map(item => ({ ...item, traitee: true }));
wixData.bulkUpdate("Monpanier",updatedData);

1 Like

hi onemoretime,

thank you very much, the changes you made work perfectly. I’m so happy, THANK YOU.
P.S : this forum is so great!!! :+1: :+1: :+1:

1 Like

It seems like it’s working. :wink: However, I believe there are still several areas in your code that could be improved. First, make sure to develop a habit of proper indentation (Wix’s editor has shortcut keys for this, so please learn them). Also, in this case, you might want to use .eq() instead of .contains() . Another point is that the current code only allows simultaneous updates for up to 50 items. If you anticipate updating more than 50 items at once, you should add .limit(100) before the .find() method. In Wix, the default value is set to .limit(50) . The current maximum limit for limit is probably still 1000.

Enjoy !! :wink:

1 Like

Hello Onemoretime

Thank your four your help and advices. I modified my code , and try to improve it as you asked me. Thanks again.

1 Like