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
users
collection - There will be
user_a
,user_b
, anduser_c
documents underusers
collection - There will be a
friends
subcollection underuser_a
anduser_b
documents __ref__:
indicates that this is aReference
data type to a document__ref__:users/user_a
will be equivalent tofirestore.collection('users').doc('user_a')