Fixture Data
Here’s a sample fixture data
const fixtureData = {
__collection__: {
users: {
__doc__: {
user_a: {
age: 15,
username: 'user_a',
__collection__: {
friends: {
__doc__: {
user_b: {
reference: '__ref__:users/user_b'
}
}
}
}
},
user_b: {
age: 10,
username: 'user_b',
__collection__: {
friends: {
__doc__: {
user_a: {
reference: '__ref__:users/user_a'
}
}
}
}
},
user_c: {
age: 20,
username: 'user_c'
}
}
}
}
}
And here’s whats going on with the example above:
- There will be a
userscollection - There will be
user_a,user_b, anduser_cdocuments underuserscollection - There will be a
friendssubcollection underuser_aanduser_bdocuments __ref__:indicates that this is aReferencedata type to a document__ref__:users/user_awill be equivalent tofirestore.collection('users').doc('user_a')