w-orm-mongodb 1.1.36 → 1.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WOrmMongodb.html">WOrmMongodb</a><ul class='methods'><li data-type='method'><a href="WOrmMongodb.html#.del">del</a></li><li data-type='method'><a href="WOrmMongodb.html#.delAll">delAll</a></li><li data-type='method'><a href="WOrmMongodb.html#.delAllGfs">delAllGfs</a></li><li data-type='method'><a href="WOrmMongodb.html#.delGfs">delGfs</a></li><li data-type='method'><a href="WOrmMongodb.html#.insert">insert</a></li><li data-type='method'><a href="WOrmMongodb.html#.insertGfs">insertGfs</a></li><li data-type='method'><a href="WOrmMongodb.html#.save">save</a></li><li data-type='method'><a href="WOrmMongodb.html#.select">select</a></li><li data-type='method'><a href="WOrmMongodb.html#.selectGfs">selectGfs</a></li></ul></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="WOrmMongodb.html">WOrmMongodb</a><ul class='methods'><li data-type='method'><a href="WOrmMongodb.html#.del">del</a></li><li data-type='method'><a href="WOrmMongodb.html#.delAll">delAll</a></li><li data-type='method'><a href="WOrmMongodb.html#.delAllGfs">delAllGfs</a></li><li data-type='method'><a href="WOrmMongodb.html#.delGfs">delGfs</a></li><li data-type='method'><a href="WOrmMongodb.html#.insert">insert</a></li><li data-type='method'><a href="WOrmMongodb.html#.insertGfs">insertGfs</a></li><li data-type='method'><a href="WOrmMongodb.html#.save">save</a></li><li data-type='method'><a href="WOrmMongodb.html#.select">select</a></li><li data-type='method'><a href="WOrmMongodb.html#.selectById">selectById</a></li><li data-type='method'><a href="WOrmMongodb.html#.selectByIdGfs">selectByIdGfs</a></li></ul></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="tag-source">Source:</dt>
82
82
  <dd class="tag-source"><ul class="dummy"><li>
83
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line35">line 35</a>
83
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line30">line 30</a>
84
84
  </li></ul></dd>
85
85
 
86
86
 
@@ -423,13 +423,15 @@
423
423
  <dl class="details">
424
424
 
425
425
  <dt class="tag-description">Description:</dt>
426
- <dd class="tag-description"><ul class="dummy"><li><p>刪除數據</p></li></ul></dd>
426
+ <dd class="tag-description"><ul class="dummy"><li><p>刪除數據
427
+ 註: n為id命中筆數;未帶有效id者視為本筆無法處理,不送查詢條件且以ok為0並附err回報;
428
+ 判斷本筆是否真的被刪除一律以nDeleted為準</p></li></ul></dd>
427
429
 
428
430
 
429
431
 
430
432
  <dt class="tag-source">Source:</dt>
431
433
  <dd class="tag-source"><ul class="dummy"><li>
432
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line311">line 311</a>
434
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line644">line 644</a>
433
435
  </li></ul></dd>
434
436
 
435
437
 
@@ -547,7 +549,7 @@
547
549
 
548
550
 
549
551
  <div class="param-desc">
550
- <p>回傳Promise,resolve回傳刪除結果,reject回傳錯誤訊息</p>
552
+ <p>回傳Promise,resolve回傳與輸入等長之刪除結果陣列,reject回傳錯誤訊息</p>
551
553
  </div>
552
554
 
553
555
 
@@ -584,13 +586,14 @@
584
586
  <dl class="details">
585
587
 
586
588
  <dt class="tag-description">Description:</dt>
587
- <dd class="tag-description"><ul class="dummy"><li><p>刪除全部數據,需與del分開,避免未傳數據導致直接刪除全表</p></li></ul></dd>
589
+ <dd class="tag-description"><ul class="dummy"><li><p>刪除全部數據,需與del分開,避免未傳數據導致直接刪除全表
590
+ 註: n為實際刪除筆數,恆等於nDeleted;條件無命中時回傳0亦屬正常結果</p></li></ul></dd>
588
591
 
589
592
 
590
593
 
591
594
  <dt class="tag-source">Source:</dt>
592
595
  <dd class="tag-source"><ul class="dummy"><li>
593
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line386">line 386</a>
596
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line756">line 756</a>
594
597
  </li></ul></dd>
595
598
 
596
599
 
@@ -762,13 +765,15 @@
762
765
  <dl class="details">
763
766
 
764
767
  <dt class="tag-description">Description:</dt>
765
- <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,刪除全部數據,需與del分開,避免未傳數據導致直接刪除全表</p></li></ul></dd>
768
+ <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,刪除全部數據,需與delGfs分開,避免未傳數據導致直接刪除全部
769
+ 註: n為實際刪除筆數,恆等於nDeleted;條件無命中時回傳0亦屬正常結果
770
+ 本函數不建立唯一索引,以免既有數據尚存重複id時無法清除</p></li></ul></dd>
766
771
 
767
772
 
768
773
 
769
774
  <dt class="tag-source">Source:</dt>
770
775
  <dd class="tag-source"><ul class="dummy"><li>
771
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line749">line 749</a>
776
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1178">line 1178</a>
772
777
  </li></ul></dd>
773
778
 
774
779
 
@@ -930,7 +935,7 @@
930
935
 
931
936
 
932
937
 
933
- <h4 class="name" id=".delGfs"><span class="type-signature type-signature-async, static">(async, static) </span>delGfs<span class="signature">(id)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
938
+ <h4 class="name" id=".delGfs"><span class="type-signature type-signature-async, static">(async, static) </span>delGfs<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
934
939
 
935
940
 
936
941
 
@@ -940,13 +945,15 @@
940
945
  <dl class="details">
941
946
 
942
947
  <dt class="tag-description">Description:</dt>
943
- <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,刪除數據</p></li></ul></dd>
948
+ <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,刪除數據
949
+ 註: n為id命中筆數;未帶有效id者視為本筆無法處理,以ok為0並附err回報;
950
+ 判斷本筆是否真的被刪除一律以nDeleted為準</p></li></ul></dd>
944
951
 
945
952
 
946
953
 
947
954
  <dt class="tag-source">Source:</dt>
948
955
  <dd class="tag-source"><ul class="dummy"><li>
949
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line641">line 641</a>
956
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1050">line 1050</a>
950
957
  </li></ul></dd>
951
958
 
952
959
 
@@ -1018,13 +1025,16 @@
1018
1025
 
1019
1026
  <tr>
1020
1027
 
1021
- <td class="name"><code>id</code></td>
1028
+ <td class="name"><code>data</code></td>
1022
1029
 
1023
1030
 
1024
1031
  <td class="type">
1025
1032
 
1026
1033
 
1027
- <span class="param-type">String</span>
1034
+ <span class="param-type">Object</span>
1035
+ |
1036
+
1037
+ <span class="param-type">Array</span>
1028
1038
 
1029
1039
 
1030
1040
 
@@ -1035,7 +1045,7 @@
1035
1045
 
1036
1046
 
1037
1047
 
1038
- <td class="description last"><p>輸入刪除id字串</p></td>
1048
+ <td class="description last"><p>輸入數據物件或陣列,各數據物件須帶id</p></td>
1039
1049
  </tr>
1040
1050
 
1041
1051
 
@@ -1061,7 +1071,7 @@
1061
1071
 
1062
1072
 
1063
1073
  <div class="param-desc">
1064
- <p>回傳Promise,resolve回傳刪除結果,reject回傳錯誤訊息</p>
1074
+ <p>回傳Promise,resolve回傳與輸入等長之刪除結果陣列,reject回傳錯誤訊息</p>
1065
1075
  </div>
1066
1076
 
1067
1077
 
@@ -1098,13 +1108,15 @@
1098
1108
  <dl class="details">
1099
1109
 
1100
1110
  <dt class="tag-description">Description:</dt>
1101
- <dd class="tag-description"><ul class="dummy"><li><p>插入數據,插入同樣數據會自動產生不同_id,故insert前需自行判斷有無重複</p></li></ul></dd>
1111
+ <dd class="tag-description"><ul class="dummy"><li><p>插入數據,僅於id不存在時寫入,已存在者跳過且不覆寫
1112
+ 由MongoDB於唯一索引上原子完成[檢查id未存在]與[寫入],併發時同一id僅有一次成功
1113
+ 註: n為輸入筆數,nInserted為實際插入筆數,全數已存在而nInserted為0屬正常結果</p></li></ul></dd>
1102
1114
 
1103
1115
 
1104
1116
 
1105
1117
  <dt class="tag-source">Source:</dt>
1106
1118
  <dd class="tag-source"><ul class="dummy"><li>
1107
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line119">line 119</a>
1119
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line342">line 342</a>
1108
1120
  </li></ul></dd>
1109
1121
 
1110
1122
 
@@ -1249,7 +1261,7 @@
1249
1261
 
1250
1262
 
1251
1263
 
1252
- <h4 class="name" id=".insertGfs"><span class="type-signature type-signature-async, static">(async, static) </span>insertGfs<span class="signature">(u8a)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1264
+ <h4 class="name" id=".insertGfs"><span class="type-signature type-signature-async, static">(async, static) </span>insertGfs<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1253
1265
 
1254
1266
 
1255
1267
 
@@ -1259,13 +1271,15 @@
1259
1271
  <dl class="details">
1260
1272
 
1261
1273
  <dt class="tag-description">Description:</dt>
1262
- <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,插入數據,需為Uint8Array格式</p></li></ul></dd>
1274
+ <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,插入數據,僅於id不存在時寫入,已存在者跳過且不覆寫
1275
+ 數據物件形狀為{ id, u8a },id未給時自動產生,u8a須為Uint8Array
1276
+ 註: n為輸入筆數,nInserted為實際插入筆數,全數已存在而nInserted為0屬正常結果</p></li></ul></dd>
1263
1277
 
1264
1278
 
1265
1279
 
1266
1280
  <dt class="tag-source">Source:</dt>
1267
1281
  <dd class="tag-source"><ul class="dummy"><li>
1268
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line440">line 440</a>
1282
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line814">line 814</a>
1269
1283
  </li></ul></dd>
1270
1284
 
1271
1285
 
@@ -1337,13 +1351,16 @@
1337
1351
 
1338
1352
  <tr>
1339
1353
 
1340
- <td class="name"><code>u8a</code></td>
1354
+ <td class="name"><code>data</code></td>
1341
1355
 
1342
1356
 
1343
1357
  <td class="type">
1344
1358
 
1345
1359
 
1346
- <span class="param-type">Uint8Array</span>
1360
+ <span class="param-type">Object</span>
1361
+ |
1362
+
1363
+ <span class="param-type">Array</span>
1347
1364
 
1348
1365
 
1349
1366
 
@@ -1354,7 +1371,7 @@
1354
1371
 
1355
1372
 
1356
1373
 
1357
- <td class="description last"></td>
1374
+ <td class="description last"><p>輸入數據物件或陣列,各數據物件形狀為{ id, u8a }</p></td>
1358
1375
  </tr>
1359
1376
 
1360
1377
 
@@ -1417,13 +1434,15 @@
1417
1434
  <dl class="details">
1418
1435
 
1419
1436
  <dt class="tag-description">Description:</dt>
1420
- <dd class="tag-description"><ul class="dummy"><li><p>儲存數據</p></li></ul></dd>
1437
+ <dd class="tag-description"><ul class="dummy"><li><p>儲存數據,以id為準更新既有數據,未給之欄位會保留;id不存在且option.autoInsert為true時改為插入
1438
+ 註: n為id命中筆數,命中或經插入而產生皆為1;[內容相同]之判定基準為將待儲存物件合併進現值後結果與現值相同,
1439
+ 相同者不寫入而nModified為0;本筆失敗不中斷整批,該筆以ok為0並附err回報</p></li></ul></dd>
1421
1440
 
1422
1441
 
1423
1442
 
1424
1443
  <dt class="tag-source">Source:</dt>
1425
1444
  <dd class="tag-source"><ul class="dummy"><li>
1426
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line211">line 211</a>
1445
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line564">line 564</a>
1427
1446
  </li></ul></dd>
1428
1447
 
1429
1448
 
@@ -1667,7 +1686,7 @@
1667
1686
 
1668
1687
 
1669
1688
  <div class="param-desc">
1670
- <p>回傳Promise,resolve回傳儲存結果,reject回傳錯誤訊息</p>
1689
+ <p>回傳Promise,resolve回傳與輸入等長之儲存結果陣列,reject回傳錯誤訊息</p>
1671
1690
  </div>
1672
1691
 
1673
1692
 
@@ -1710,7 +1729,7 @@
1710
1729
 
1711
1730
  <dt class="tag-source">Source:</dt>
1712
1731
  <dd class="tag-source"><ul class="dummy"><li>
1713
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line65">line 65</a>
1732
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line233">line 233</a>
1714
1733
  </li></ul></dd>
1715
1734
 
1716
1735
 
@@ -1845,7 +1864,166 @@
1845
1864
 
1846
1865
 
1847
1866
  <div class="param-desc">
1848
- <p>回傳Promise,resolve回傳數據,reject回傳錯誤訊息</p>
1867
+ <p>回傳Promise,resolve回傳數據陣列,無符合數據回傳空陣列,reject回傳錯誤訊息</p>
1868
+ </div>
1869
+
1870
+
1871
+
1872
+ <dl class="param-type">
1873
+ <dt>
1874
+ Type
1875
+ </dt>
1876
+ <dd>
1877
+
1878
+ <span class="param-type">Promise</span>
1879
+
1880
+
1881
+
1882
+ </dd>
1883
+ </dl>
1884
+
1885
+
1886
+
1887
+
1888
+
1889
+
1890
+
1891
+
1892
+
1893
+
1894
+ <h4 class="name" id=".selectById"><span class="type-signature type-signature-async, static">(async, static) </span>selectById<span class="signature">(id)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1895
+
1896
+
1897
+
1898
+
1899
+
1900
+
1901
+ <dl class="details">
1902
+
1903
+ <dt class="tag-description">Description:</dt>
1904
+ <dd class="tag-description"><ul class="dummy"><li><p>由id查詢單筆數據,因由MongoDB查找且僅回傳單筆,不需如select提取全部符合數據再處理,故數據量大時效能較佳
1905
+ 註: 本函數不得有副作用,故不建立唯一索引</p></li></ul></dd>
1906
+
1907
+
1908
+
1909
+ <dt class="tag-source">Source:</dt>
1910
+ <dd class="tag-source"><ul class="dummy"><li>
1911
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line284">line 284</a>
1912
+ </li></ul></dd>
1913
+
1914
+
1915
+
1916
+
1917
+
1918
+
1919
+
1920
+
1921
+
1922
+
1923
+
1924
+
1925
+
1926
+
1927
+
1928
+
1929
+
1930
+
1931
+
1932
+
1933
+
1934
+
1935
+
1936
+
1937
+
1938
+
1939
+
1940
+
1941
+
1942
+
1943
+
1944
+ </dl>
1945
+
1946
+
1947
+
1948
+
1949
+
1950
+
1951
+
1952
+
1953
+
1954
+
1955
+
1956
+
1957
+
1958
+ <h5 class="h5-parameters">Parameters:</h5>
1959
+
1960
+
1961
+ <table class="params">
1962
+ <thead>
1963
+ <tr>
1964
+
1965
+ <th>Name</th>
1966
+
1967
+
1968
+ <th>Type</th>
1969
+
1970
+
1971
+
1972
+
1973
+
1974
+ <th class="last">Description</th>
1975
+ </tr>
1976
+ </thead>
1977
+
1978
+ <tbody>
1979
+
1980
+
1981
+ <tr>
1982
+
1983
+ <td class="name"><code>id</code></td>
1984
+
1985
+
1986
+ <td class="type">
1987
+
1988
+
1989
+ <span class="param-type">String</span>
1990
+
1991
+
1992
+
1993
+
1994
+ </td>
1995
+
1996
+
1997
+
1998
+
1999
+
2000
+ <td class="description last"><p>輸入id字串</p></td>
2001
+ </tr>
2002
+
2003
+
2004
+ </tbody>
2005
+ </table>
2006
+
2007
+
2008
+
2009
+
2010
+
2011
+
2012
+
2013
+
2014
+
2015
+
2016
+
2017
+
2018
+
2019
+
2020
+
2021
+
2022
+ <h5 class="h5-returns">Returns:</h5>
2023
+
2024
+
2025
+ <div class="param-desc">
2026
+ <p>回傳Promise,resolve回傳數據物件,若無此id或id無效則回傳null,reject回傳錯誤訊息</p>
1849
2027
  </div>
1850
2028
 
1851
2029
 
@@ -1872,7 +2050,7 @@
1872
2050
 
1873
2051
 
1874
2052
 
1875
- <h4 class="name" id=".selectGfs"><span class="type-signature type-signature-async, static">(async, static) </span>selectGfs<span class="signature">(id)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
2053
+ <h4 class="name" id=".selectByIdGfs"><span class="type-signature type-signature-async, static">(async, static) </span>selectByIdGfs<span class="signature">(id)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1876
2054
 
1877
2055
 
1878
2056
 
@@ -1882,13 +2060,15 @@
1882
2060
  <dl class="details">
1883
2061
 
1884
2062
  <dt class="tag-description">Description:</dt>
1885
- <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,查詢數據</p></li></ul></dd>
2063
+ <dd class="tag-description"><ul class="dummy"><li><p>使用GridFS,由id查詢單筆數據
2064
+ 註: 查無數據或id無效時回傳null,判定基準與selectById一致
2065
+ 本函數不得有副作用,故不建立唯一索引</p></li></ul></dd>
1886
2066
 
1887
2067
 
1888
2068
 
1889
2069
  <dt class="tag-source">Source:</dt>
1890
2070
  <dd class="tag-source"><ul class="dummy"><li>
1891
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line528">line 528</a>
2071
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line920">line 920</a>
1892
2072
  </li></ul></dd>
1893
2073
 
1894
2074
 
@@ -2003,7 +2183,7 @@
2003
2183
 
2004
2184
 
2005
2185
  <div class="param-desc">
2006
- <p>回傳Promise,resolve回傳數據,reject回傳錯誤訊息</p>
2186
+ <p>回傳Promise,resolve回傳數據物件{ id, u8a },若無此id或id無效則回傳null,reject回傳錯誤訊息</p>
2007
2187
  </div>
2008
2188
 
2009
2189
 
@@ -2045,7 +2225,7 @@
2045
2225
  <br class="clear">
2046
2226
 
2047
2227
  <footer>
2048
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri Aug 07 2026 23:38:55 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2228
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 16 2026 22:37:44 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2049
2229
  </footer>
2050
2230
 
2051
2231
  <script>prettyPrint();</script>