File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -136,14 +136,21 @@ If you use the `setupDb` method to create a named database and one or more named
136136// is just an example of how to use multiple data stores on a database.
137137
138138async function main () {
139+ // set up the database with 2 stores
140+ DataStore .setupDb ({
141+ name: ' My Database' ,
142+ storesToCreate: [' data' , ' metadata' ],
143+ });
144+
139145 // 'data' is the default object store name so we can omit it
140146 const store = new DataStore (' My Database' );
141- // number keys get turned into strings under the hood
147+ // let’s say we’re using post id for the key.
148+ // number keys get turned into strings under the hood.
142149 const post = await store .getItem (1 );
143150
144151 // specify database name and object store name if not using default.
145152 const metaStore = new DataStore (' My Database' , ' metadata' );
146- const likes = await metaStore .getItem (' likes-1 ' );
153+ const likes = await metaStore .getItem (1 );
147154
148155 return { post, likes };
149156}
You can’t perform that action at this time.
0 commit comments