CloudDB and Lists

Hi. I'm developing an application that uses CloudDB. in a class tag, there is a list which has a list as well. each element of the "class" tag is a list whose first index is the name of the room and the rest of the elements include a list of first and last names for each student in the room.
I would like to allow admins to add students.
but I can't seem to add values ​​inside lists by cloudDB.
I thought of the "Store Value" block but if 2 admins add a user at the same time there will be loss of data

You need to call back the value (list) of the tag you want to work with and edit/append that list then return it to the cloudDB.

Methods
AppendValueToList(tag,itemToAdd)
Append a value to the end of a list atomically. If two devices use this function simultaneously, both will be appended and no data lost.

Alternatively, change your cloudDB structure so that only a single item of data is changed.

or for more flexibility use Firebase Realtime Database

if I copy the value of the tag and change it and then put it back to cloudDB, then the data could be lost when used by multiple users at the same time.
if I use "Add value to list", then it will add an element to the list in the tag, or in my case, this element is a student class while I am looking to add a student in an element existing from the list in the tag

Yes....that is just about correct

If you make your tags include both class name and student name, you get finer granularity and don't need to keep lists as values.

Example:

AI2Coding/TimAI2: true
AI2Coding/ABG: true

Each enrollment can be changed without affecting the other.

I have difficulties to understand

My approach requires you to ask for a TagList from CloudDB to see all the combinations of class and student.
Does that help ?

Here an example in blocks:

it's also a structuring method. But if different users were to add animals to the list in real time, my problem will still be relevant. either they will copy the list will modify it then resend it but some will have to send theirs after others have copied. there will always be a loss of data.
I hope you understand what I'm trying to explain to you

You are quite correct.
This dooms all attempts to keep a list under any tag in any shared tag/value database.

So the only answer would be to avoid any data structure that keeps any list under any tag.

Taglist is your savior, along with compound tags.

OK, thanks. so i would like to use a cloudDB isolate from the main for this situation and my application is multiscreen. i would like to know how to handle this

  • collisions are unlikely but could happen. Solution, use a different database solution-not a real time database. Have you tried intentionally to make a collision happen? What were the results?
  • you do have the ability to confirm data is/was received. See DataChanged( tag , value ) Indicates that the data in the CloudDB project has changed. Launches an event with the tag that has been updated and the value it now has. Seems this is a possible solution to confirm data is received. Write some code and try it.
  • write code to disallow any changes by other 'users; while a Tag is being updated
  • use your own Redis database and perhaps you can follow this advice
  • using your own Redis? See the ability to append only in this article https://www.oreilly.com/library/view/redis-cookbook/9781449311353/ch04.html
  • ask you questions re commercial application here https://forum.redislabs.com/ and solutions to problems you anticipate
  • consider using FirebaseDB
    Avoid synching collisions based on timestamp in Firebase

Good luck.

Since I intend to address the application to a rigorous audience, I cannot afford the possibilities of data collisions.
I also do have the expertise to go deep into Redis databases. So I'm going to try to use one of the tags as the class name and the student lists as the value. this will greatly simplify the operation. Thanks for the help everyone

You can add constant text parts to tags to allow filtering of them from a taglist.

For example, to list all students in school in 2021, request a taglist and filter out the tags starting with (edited to fool html - ABG)

/2021/student/<studentname>, to get
/2021/student/ABG
/2021/student/qoocim_alimi

...
and cut off the /2021/student prefixes to just get student names.

Other useful prefixes:

/2021/curriculum/<coursename>
/2021/enrollment/<coursename>/<student>

There is a price to pay for this excessive granularity.
Database usage will be high because of the frequent taglist requests.
A database that allows buckets could be used to reduce the taglist scopes.

On the other hand, fine grained tags reduce the collision circumstances to occasions like two instructors updating the same student in the same course simultaneously. How likely is that?

It is very weak but existing. So I will see among all these solutions, the one that suits me and apply it

Here is an additional approach, based on request timing.
It is not rigorous.
Maybe it could be made rigorous through addition of timestamps.

The animals list was just for loading up some data to cloudDB. You need to look at things beyond taht to see how you can add a single item to your cloudDB without a collision.

If you are really that worried about collisions, then you should perhaps consider firebase realtime database as your online database.

You could use google sheets and google apps script, and use the Lock Service to prevent collisions.