I’m looking to default a number of database fields in a database collection to either 0 or “£0” but can’t seem to figure out how.
Would i used the save( ) function, and if so, how do i make sure the record is being saved to the current user logged in?
Thanks
Hey,
You can get the current user with the currentUser method from wix-users module (https://www.wix.com/code/reference/wix-users.html#currentUser)
Then you can try to find (https://www.wix.com/code/reference/wix-data.WixDataQuery.html#find) the users id in your collection, and if it doesn’t appear there means she is a new one. Then you can use the save (or insert) methods to save the data (including the user’s id).