w-orm-mongodb 1.1.42 → 1.1.44

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#.selectByPk">selectByPk</a></li><li data-type='method'><a href="WOrmMongodb.html#.selectByPkGfs">selectByPkGfs</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#.insertBulk">insertBulk</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#.selectByPk">selectByPk</a></li><li data-type='method'><a href="WOrmMongodb.html#.selectByPkGfs">selectByPkGfs</a></li></ul></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -83,7 +83,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
83
83
 
84
84
  <dt class="tag-source">Source:</dt>
85
85
  <dd class="tag-source"><ul class="dummy"><li>
86
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line36">line 36</a>
86
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line39">line 39</a>
87
87
  </li></ul></dd>
88
88
 
89
89
 
@@ -474,7 +474,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
474
474
 
475
475
  <dt class="tag-source">Source:</dt>
476
476
  <dd class="tag-source"><ul class="dummy"><li>
477
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line729">line 729</a>
477
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line980">line 980</a>
478
478
  </li></ul></dd>
479
479
 
480
480
 
@@ -636,7 +636,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
636
636
 
637
637
  <dt class="tag-source">Source:</dt>
638
638
  <dd class="tag-source"><ul class="dummy"><li>
639
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line857">line 857</a>
639
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1108">line 1108</a>
640
640
  </li></ul></dd>
641
641
 
642
642
 
@@ -816,7 +816,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
816
816
 
817
817
  <dt class="tag-source">Source:</dt>
818
818
  <dd class="tag-source"><ul class="dummy"><li>
819
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1311">line 1311</a>
819
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1562">line 1562</a>
820
820
  </li></ul></dd>
821
821
 
822
822
 
@@ -996,7 +996,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
996
996
 
997
997
  <dt class="tag-source">Source:</dt>
998
998
  <dd class="tag-source"><ul class="dummy"><li>
999
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1167">line 1167</a>
999
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1418">line 1418</a>
1000
1000
  </li></ul></dd>
1001
1001
 
1002
1002
 
@@ -1141,7 +1141,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
1141
1141
 
1142
1142
 
1143
1143
 
1144
- <h4 class="name" id=".insert"><span class="type-signature type-signature-async, static">(async, static) </span>insert<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1144
+ <h4 class="name" id=".insert"><span class="type-signature type-signature-async, static">(async, static) </span>insert<span class="signature">(data, option<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1145
1145
 
1146
1146
 
1147
1147
 
@@ -1153,14 +1153,310 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
1153
1153
  <dt class="tag-description">Description:</dt>
1154
1154
  <dd class="tag-description"><ul class="dummy"><li><p>插入數據,僅於id不存在時寫入,已存在者跳過且不覆寫
1155
1155
  由MongoDB於唯一索引上原子完成[檢查id未存在]與[寫入],併發時同一id僅有一次成功
1156
- 註: n為輸入筆數,nInserted為實際插入筆數,全數已存在而nInserted為0屬正常結果
1156
+ 註: 預設回傳單一聚合物件,n為輸入筆數,nInserted為實際插入筆數,全數已存在而nInserted為0屬正常結果
1157
+ 註: option.returnList為true時改回與輸入等長且保序之逐筆陣列,供呼叫端得知[是哪幾筆]為新數據,
1158
+ 聚合計數僅能回答[有幾筆],而去重類呼叫端須知何者為新方能對其執行下游動作
1157
1159
  註: opt.autoGenPk為true(預設)時未帶有效id者自動產生,為false時未帶有效id即reject且同批皆不寫入</p></li></ul></dd>
1158
1160
 
1159
1161
 
1160
1162
 
1161
1163
  <dt class="tag-source">Source:</dt>
1162
1164
  <dd class="tag-source"><ul class="dummy"><li>
1163
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line421">line 421</a>
1165
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line432">line 432</a>
1166
+ </li></ul></dd>
1167
+
1168
+
1169
+
1170
+
1171
+
1172
+
1173
+
1174
+
1175
+
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+
1186
+
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+ </dl>
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1206
+
1207
+
1208
+
1209
+
1210
+
1211
+
1212
+ <h5 class="h5-parameters">Parameters:</h5>
1213
+
1214
+
1215
+ <table class="params">
1216
+ <thead>
1217
+ <tr>
1218
+
1219
+ <th>Name</th>
1220
+
1221
+
1222
+ <th>Type</th>
1223
+
1224
+
1225
+ <th>Attributes</th>
1226
+
1227
+
1228
+
1229
+ <th>Default</th>
1230
+
1231
+
1232
+ <th class="last">Description</th>
1233
+ </tr>
1234
+ </thead>
1235
+
1236
+ <tbody>
1237
+
1238
+
1239
+ <tr>
1240
+
1241
+ <td class="name"><code>data</code></td>
1242
+
1243
+
1244
+ <td class="type">
1245
+
1246
+
1247
+ <span class="param-type">Object</span>
1248
+ |
1249
+
1250
+ <span class="param-type">Array</span>
1251
+
1252
+
1253
+
1254
+
1255
+ </td>
1256
+
1257
+
1258
+ <td class="attributes">
1259
+
1260
+
1261
+
1262
+
1263
+
1264
+ </td>
1265
+
1266
+
1267
+
1268
+ <td class="default">
1269
+
1270
+ </td>
1271
+
1272
+
1273
+ <td class="description last"><p>輸入數據物件或陣列</p></td>
1274
+ </tr>
1275
+
1276
+
1277
+
1278
+ <tr>
1279
+
1280
+ <td class="name"><code>option</code></td>
1281
+
1282
+
1283
+ <td class="type">
1284
+
1285
+
1286
+ <span class="param-type">Object</span>
1287
+
1288
+
1289
+
1290
+
1291
+ </td>
1292
+
1293
+
1294
+ <td class="attributes">
1295
+
1296
+ &lt;optional><br>
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+ </td>
1303
+
1304
+
1305
+
1306
+ <td class="default">
1307
+
1308
+ <code>{}</code>
1309
+
1310
+ </td>
1311
+
1312
+
1313
+ <td class="description last"><p>輸入設定物件,預設為{}</p>
1314
+ <h6>Properties</h6>
1315
+
1316
+
1317
+ <table class="params">
1318
+ <thead>
1319
+ <tr>
1320
+
1321
+ <th>Name</th>
1322
+
1323
+
1324
+ <th>Type</th>
1325
+
1326
+
1327
+ <th>Attributes</th>
1328
+
1329
+
1330
+
1331
+ <th>Default</th>
1332
+
1333
+
1334
+ <th class="last">Description</th>
1335
+ </tr>
1336
+ </thead>
1337
+
1338
+ <tbody>
1339
+
1340
+
1341
+ <tr>
1342
+
1343
+ <td class="name"><code>returnList</code></td>
1344
+
1345
+
1346
+ <td class="type">
1347
+
1348
+
1349
+ <span class="param-type">Boolean</span>
1350
+
1351
+
1352
+
1353
+
1354
+ </td>
1355
+
1356
+
1357
+ <td class="attributes">
1358
+
1359
+ &lt;optional><br>
1360
+
1361
+
1362
+
1363
+
1364
+
1365
+ </td>
1366
+
1367
+
1368
+
1369
+ <td class="default">
1370
+
1371
+ <code>false</code>
1372
+
1373
+ </td>
1374
+
1375
+
1376
+ <td class="description last"><p>輸入是否改回逐筆結果陣列,預設為false。為true時回傳與輸入等長且保序之陣列,各元素為{ n, nInserted, ok },已插入者nInserted為1、已存在而跳過者為0</p></td>
1377
+ </tr>
1378
+
1379
+
1380
+ </tbody>
1381
+ </table>
1382
+
1383
+ </td>
1384
+ </tr>
1385
+
1386
+
1387
+ </tbody>
1388
+ </table>
1389
+
1390
+
1391
+
1392
+
1393
+
1394
+
1395
+
1396
+
1397
+
1398
+
1399
+
1400
+
1401
+
1402
+
1403
+
1404
+
1405
+ <h5 class="h5-returns">Returns:</h5>
1406
+
1407
+
1408
+ <div class="param-desc">
1409
+ <p>回傳Promise,resolve回傳插入結果,returnList為true時回傳逐筆結果陣列,reject回傳錯誤訊息</p>
1410
+ </div>
1411
+
1412
+
1413
+
1414
+ <dl class="param-type">
1415
+ <dt>
1416
+ Type
1417
+ </dt>
1418
+ <dd>
1419
+
1420
+ <span class="param-type">Promise</span>
1421
+
1422
+
1423
+
1424
+ </dd>
1425
+ </dl>
1426
+
1427
+
1428
+
1429
+
1430
+
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+ <h4 class="name" id=".insertBulk"><span class="type-signature type-signature-async, static">(async, static) </span>insertBulk<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+ <dl class="details">
1444
+
1445
+ <dt class="tag-description">Description:</dt>
1446
+ <dd class="tag-description"><ul class="dummy"><li><p>批次插入數據,全批視為一個單位:全部插入成功,或一筆都不寫入
1447
+ 任一筆之id已存在(含同批含重複id)即以reject拋出整批性錯誤,且不寫入任何一筆
1448
+ 註: 本函數非insert之加速版,兩者衝突政策不同——insert跳過已存在者而整批ok為1,
1449
+ 本函數則整批reject;需要逐筆處置者改用insert
1450
+ 註: n為輸入筆數,nInserted於成功時恆等於n;不提供逐筆結果,故不出現ok為0與err
1451
+ 註: opt.autoGenPk為true(預設)時未帶有效id者自動產生,為false時未帶有效id即reject且同批皆不寫入
1452
+ 註: 全有全無之達成方式依部署而異——具replica set或分片叢集者以交易包覆,
1453
+ standalone無交易可用而以補償動作達成,其限制詳見_insertBulkByCompensate</p></li></ul></dd>
1454
+
1455
+
1456
+
1457
+ <dt class="tag-source">Source:</dt>
1458
+ <dd class="tag-source"><ul class="dummy"><li>
1459
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line682">line 682</a>
1164
1460
  </li></ul></dd>
1165
1461
 
1166
1462
 
@@ -1324,7 +1620,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
1324
1620
 
1325
1621
  <dt class="tag-source">Source:</dt>
1326
1622
  <dd class="tag-source"><ul class="dummy"><li>
1327
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line921">line 921</a>
1623
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1172">line 1172</a>
1328
1624
  </li></ul></dd>
1329
1625
 
1330
1626
 
@@ -1488,7 +1784,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
1488
1784
 
1489
1785
  <dt class="tag-source">Source:</dt>
1490
1786
  <dd class="tag-source"><ul class="dummy"><li>
1491
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line649">line 649</a>
1787
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line900">line 900</a>
1492
1788
  </li></ul></dd>
1493
1789
 
1494
1790
 
@@ -1775,7 +2071,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
1775
2071
 
1776
2072
  <dt class="tag-source">Source:</dt>
1777
2073
  <dd class="tag-source"><ul class="dummy"><li>
1778
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line300">line 300</a>
2074
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line307">line 307</a>
1779
2075
  </li></ul></dd>
1780
2076
 
1781
2077
 
@@ -1955,7 +2251,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
1955
2251
 
1956
2252
  <dt class="tag-source">Source:</dt>
1957
2253
  <dd class="tag-source"><ul class="dummy"><li>
1958
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line357">line 357</a>
2254
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line364">line 364</a>
1959
2255
  </li></ul></dd>
1960
2256
 
1961
2257
 
@@ -2116,7 +2412,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
2116
2412
 
2117
2413
  <dt class="tag-source">Source:</dt>
2118
2414
  <dd class="tag-source"><ul class="dummy"><li>
2119
- <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1031">line 1031</a>
2415
+ <a href="WOrmMongodb.mjs.html">WOrmMongodb.mjs</a>, <a href="WOrmMongodb.mjs.html#line1282">line 1282</a>
2120
2416
  </li></ul></dd>
2121
2417
 
2122
2418
 
@@ -2273,7 +2569,7 @@ opt.autoGenPk為false時套件一律不產生id,未帶有效id者以reject拋
2273
2569
  <br class="clear">
2274
2570
 
2275
2571
  <footer>
2276
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Mon Aug 17 2026 09:16:25 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2572
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Mon Aug 17 2026 18:43:44 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2277
2573
  </footer>
2278
2574
 
2279
2575
  <script>prettyPrint();</script>