'accessing certain collection that belongs to a user by autogenerated code or id?

I am new to firebase and I want to insure if I can implement a certain feature , the feature that I want to make is a user (needs a log in )make a certain data, for certain user , the second user can have access to the created data in a read only way but without a log in only by using a code that the main user sent him ? is this thing possible or should go with monodb, I don't want to create fake users for this I just want to be able to grant access to certain generated data.

// main user object 

main user data 
{
dataSetid1 : [9,887,897,789,789,456,456]
dataSetid2 : [0,2,1,19,789,3,6]
}


// Low privlige user can see only his set not datasetid2
dataSetid1 : [9,887,897,789,789,456,456]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source