質問編集履歴

3

訂正

2018/12/13 03:11

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -30,9 +30,9 @@
30
30
 
31
31
  Promise.all(promiseArr)
32
32
 
33
- .then(res => console.log('???? ' + res))
33
+ .then(res => console.log(res))
34
34
 
35
- .catch(err => console.log('❌ ' + err))
35
+ .catch(err => console.log(err))
36
36
 
37
37
  }
38
38
 

2

補足

2018/12/13 03:10

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -19,6 +19,26 @@
19
19
 
20
20
 
21
21
  ```
22
+
23
+
24
+
25
+ const updateTaggedQuantity = async() => {
26
+
27
+ let promiseArr = [];
28
+
29
+ ['旅行','おでかけ','デート'].forEach(tagName => promiseArr.push(increaseQuantity(tagName)));
30
+
31
+ Promise.all(promiseArr)
32
+
33
+ .then(res => console.log('???? ' + res))
34
+
35
+ .catch(err => console.log('❌ ' + err))
36
+
37
+ }
38
+
39
+
40
+
41
+
22
42
 
23
43
  const increaseQuantity = async (tagNames) => {
24
44
 

1

誤植訂正

2018/12/13 03:10

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  console.log('開始');
26
26
 
27
- const updates = tagIds.map((tagname) => {
27
+ const updates = tagNames.map((tagname) => {
28
28
 
29
29
  return Tag.findOneAndUpdate({ name: tagname }, { $inc: { taggedQuantity: 1 } }, { new: true });
30
30