File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
docs/docs-main/module-setup Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -180,18 +180,23 @@ import { magnetar } from 'magnetarSetup.js'
180180
181181const userId = ' abc123'
182182const userPokedexModule = magnetar .collection (` users/${ userId} /pokedex` )
183+ // OR
184+ const users = magnetar .collection (' users' )
185+ const userPokedexModule = users .doc (userId).collection (' pokedex' )
183186```
184187
185188In your app you probably need to encapsulate this in a function which you can trigger once you have the user ID:
186189
187190``` js
188191import { 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 */
193198export const userPokedexModule = (userId ) => {
194- return magnetar . collection ( ` users/ ${ userId} / pokedex` )
199+ return users . doc ( userId). collection ( ' pokedex' )
195200}
196201```
197202
You can’t perform that action at this time.
0 commit comments