Understanding insertreference in corvid

Hi all.

I am trying to create 2 databases (call them A and B for now).

One has data I don’t want to be accessed via http requests so this is set to be viewed only by registered members so I can create a dashboard on the website.

The other will only contain a reference to a users _id in database A, and whether they are active or not (just a boolean).

What I want to do is reference the active status from database B in database A. But I need to do this automatically through corvid on a http post request.
The main section (title) can be used in both databases for the active status.

Can someone please explain the insertReference command please.

wixData.insertReference(collectionName, propertyName, referringItem, referencedItem, options)

I don’t understand which database goes in which part of the command? I have looked on every other forum and the API documentation.

Thank you in advance.

Hi,
So the function has the following parameters:

  • collectionName - name of the collection that contains the referring item (e.g. if the collection B has a reference field to the collection A, then the collection A will be the name to insert).

  • propertyName - the property to insert the reference into (column id in database A).

  • referringItem - The referring item or referring item’s ID.

  • referencedItem - The referenced item, referenced item’s ID, an array of referenced items, or an array of referenced item IDs.
    You can see complete description with an example here .