@arjunchahal I can see why you would be confused. Instead of 2 collections, we are actually dealing with 3 collections. Ok, so that definitely changes our logic … again.
Your goal is to display the extra data that you added into your custom plans database.
What is happening now, with the existing logic, is that the plan reference field won’t match your custom database collection. The reason is because when the purchase event happens, the code is taking the plan ID from the actual Paid Plans database instead of the plan ID from the custom database collection.
(And we definitely cannot add a reference field into the read-only plans database.)
This is where you have to get creative to reach your end goal. While there are many fluid and clunky approaches you can take at this point … if this were my site, I would:
Add a custom to insert a new record into the custom plans database. This way I can tell the code which specific ID number I want for each record. Meaning I can use the same ID for both database collections.
(Don’t worry. 2 different collections can have the same ID.)
Something like: OnReady insert a new record, set _id to be ‘this’. I would repeat this for each paid plan. All you really need to insert is the _id because you can manually edit the rest of the fields without inserting them via code.
This would result in: having the same matching _id so that when the code filters the dataset, it actually does find a valid ID via the reference field.
(I hope I did not confuse you even more … )