Working with Data in a collection

New to Wix but a database developer SQL/Access, etc. So i can import data from CSV into a collection and see the options to filter that data and such. There is alot of data say 500 rows as an example. My questions are:

  1. When I import a new file, it just appends the data to the end of the current collection. I want it to overwrite what is in there, not append. Is there an option to do this or do I have to delete all the current records in the collection before importing new data which leads to question 2.
  2. How do I delete all the data in a collection at once(not selecting a few rows to delete) but all with 1 click as we have alot of rows of data.
  3. When I delete a collection, then add a new collection with the same name, it pulls up the one I deleted with all the old data. Is there a way to have the collection actually deleted from the system or no?
  4. I am trying to mimic somewhat what we have now using a SQL server, tables that link and can select say a team and it pulls up just that teams game schedule. Something like that is posslbe in Wix right?

Hello Leo,

  1. This can be done with code and using the update function found here instead of the insert I’m assuming your using - wix-data - Velo API Reference - Wix.com

  2. Here is the code for deleting all items in a collection:

 wixData.query("NewCollectionName”) 
.limit(1000) 
.find() 
.then((result) => { 
    for (var i = 0; i < result.items.length; i++){ 
      if (result.items[i] === null) 
         continue;            
         wixData.remove("NewCollectionName", result.items[i]._id);
     }         
     console.log('erase done'); 
}); 
  1. As of now a hard delete for collections is not available, Wix only does soft deletes with collections.

  2. Yes this is possible, as long as your data is in CSV format you can import/export between the two if needed.

Goodluck, if you need anything else let me know!
Majd