Skip to content

Commit 367dbee

Browse files
committed
chore: tweak
1 parent e84c799 commit 367dbee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/docs-main/module-setup/index.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,23 @@ import { magnetar } from 'magnetarSetup.js'
180180

181181
const userId = 'abc123'
182182
const userPokedexModule = magnetar.collection(`users/${userId}/pokedex`)
183+
// OR
184+
const users = magnetar.collection('users')
185+
const userPokedexModule = users.doc(userId).collection('pokedex')
183186
```
184187

185188
In your app you probably need to encapsulate this in a function which you can trigger once you have the user ID:
186189

187190
```js
188191
import { magnetar } from 'magnetarSetup.js'
189192

193+
const users = magnetar.collection('users')
194+
190195
/**
191-
* @param {string} userId - this must be fetched first to instantiate the pokedexModule module
196+
* @param {string} userId - this must be fetched first to instantiate the pokedexModule
192197
*/
193198
export const userPokedexModule = (userId) => {
194-
return magnetar.collection(`users/${userId}/pokedex`)
199+
return users.doc(userId).collection('pokedex')
195200
}
196201
```
197202

0 commit comments

Comments
 (0)