UNPKG

32.1 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Class: DynamicView</title>
6
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
9 <!--[if lt IE 9]>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14</head>
15
16<body>
17
18<div id="main">
19
20 <h1 class="page-title">Class: DynamicView</h1>
21
22
23
24
25
26
27<section>
28
29<header>
30
31 <h2>DynamicView</h2>
32
33
34</header>
35
36<article>
37 <div class="container-overview">
38
39
40
41
42
43 <h4 class="name" id="DynamicView"><span class="type-signature"></span>new DynamicView<span class="signature">(collection, name, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
44
45
46
47
48
49<div class="description">
50 <p>DynamicView class is a versatile 'live' view class which can have filters and sorts applied.
51 Collection.addDynamicView(name) instantiates this DynamicView object and notifies it
52 whenever documents are add/updated/removed so it can remain up-to-date. (chainable)</p>
53</div>
54
55
56
57
58
59
60
61
62
63 <h5>Parameters:</h5>
64
65
66<table class="params">
67 <thead>
68 <tr>
69
70 <th>Name</th>
71
72
73 <th>Type</th>
74
75
76 <th>Attributes</th>
77
78
79
80
81 <th class="last">Description</th>
82 </tr>
83 </thead>
84
85 <tbody>
86
87
88 <tr>
89
90 <td class="name"><code>collection</code></td>
91
92
93 <td class="type">
94
95
96<span class="param-type"><a href="Collection.html">Collection</a></span>
97
98
99
100 </td>
101
102
103 <td class="attributes">
104
105
106
107
108
109 </td>
110
111
112
113
114 <td class="description last"><p>A reference to the collection to work against</p></td>
115 </tr>
116
117
118
119 <tr>
120
121 <td class="name"><code>name</code></td>
122
123
124 <td class="type">
125
126
127<span class="param-type">string</span>
128
129
130
131 </td>
132
133
134 <td class="attributes">
135
136
137
138
139
140 </td>
141
142
143
144
145 <td class="description last"><p>The name of this dynamic view</p></td>
146 </tr>
147
148
149
150 <tr>
151
152 <td class="name"><code>options</code></td>
153
154
155 <td class="type">
156
157
158<span class="param-type">object</span>
159
160
161
162 </td>
163
164
165 <td class="attributes">
166
167 &lt;optional><br>
168
169
170
171
172
173 </td>
174
175
176
177
178 <td class="description last"><p>(Optional) Pass in object with 'persistent' and/or 'sortPriority' options.</p>
179 <h6>Properties</h6>
180
181
182<table class="params">
183 <thead>
184 <tr>
185
186 <th>Name</th>
187
188
189 <th>Type</th>
190
191
192
193
194
195 <th class="last">Description</th>
196 </tr>
197 </thead>
198
199 <tbody>
200
201
202 <tr>
203
204 <td class="name"><code>persistent</code></td>
205
206
207 <td class="type">
208
209
210<span class="param-type">boolean</span>
211
212
213
214 </td>
215
216
217
218
219
220 <td class="description last"><p>indicates if view is to main internal results array in 'resultdata'</p></td>
221 </tr>
222
223
224
225 <tr>
226
227 <td class="name"><code>sortPriority</code></td>
228
229
230 <td class="type">
231
232
233<span class="param-type">string</span>
234
235
236
237 </td>
238
239
240
241
242
243 <td class="description last"><p>'passive' (sorts performed on call to data) or 'active' (after updates)</p></td>
244 </tr>
245
246
247
248 <tr>
249
250 <td class="name"><code>minRebuildInterval</code></td>
251
252
253 <td class="type">
254
255
256<span class="param-type">number</span>
257
258
259
260 </td>
261
262
263
264
265
266 <td class="description last"><p>minimum rebuild interval (need clarification to docs here)</p></td>
267 </tr>
268
269
270 </tbody>
271</table>
272
273 </td>
274 </tr>
275
276
277 </tbody>
278</table>
279
280
281
282
283
284
285<dl class="details">
286
287
288
289
290
291
292
293
294
295
296
297
298 <dt class="implements">Implements:</dt>
299 <dd class="implements"><ul>
300
301 <li><a href="LokiEventEmitter.html">LokiEventEmitter</a></li>
302
303 </ul></dd>
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319 <dt class="tag-source">Source:</dt>
320 <dd class="tag-source"><ul class="dummy"><li>
321 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3238">line 3238</a>
322 </li></ul></dd>
323
324
325
326
327
328 <dt class="tag-see">See:</dt>
329 <dd class="tag-see">
330 <ul>
331 <li><a href="Collection.html#addDynamicView">Collection#addDynamicView</a> to construct instances of DynamicView</li>
332 </ul>
333 </dd>
334
335
336
337</dl>
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353 <h5>Example</h5>
354
355 <pre class="prettyprint"><code>var mydv = mycollection.addDynamicView('test'); // default is non-persistent mydv.applyFind({ 'doors' : 4 }); mydv.applyWhere(function(obj) { return obj.name === 'Toyota'; }); var results = mydv.data();</code></pre>
356
357
358
359
360 </div>
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375 <h3 class="subsection-title">Methods</h3>
376
377
378
379
380
381
382 <h4 class="name" id="applyFilter"><span class="type-signature"></span>applyFilter<span class="signature">(filter)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
383
384
385
386
387
388<div class="description">
389 <p>applyFilter() - Adds or updates a filter in the DynamicView filter pipeline</p>
390</div>
391
392
393
394
395
396
397
398
399
400 <h5>Parameters:</h5>
401
402
403<table class="params">
404 <thead>
405 <tr>
406
407 <th>Name</th>
408
409
410 <th>Type</th>
411
412
413
414
415
416 <th class="last">Description</th>
417 </tr>
418 </thead>
419
420 <tbody>
421
422
423 <tr>
424
425 <td class="name"><code>filter</code></td>
426
427
428 <td class="type">
429
430
431<span class="param-type">object</span>
432
433
434
435 </td>
436
437
438
439
440
441 <td class="description last"><p>A filter object to add to the pipeline.
442 The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id }</p></td>
443 </tr>
444
445
446 </tbody>
447</table>
448
449
450
451
452
453
454<dl class="details">
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481 <dt class="tag-source">Source:</dt>
482 <dd class="tag-source"><ul class="dummy"><li>
483 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3606">line 3606</a>
484 </li></ul></dd>
485
486
487
488
489
490
491
492</dl>
493
494
495
496
497
498
499
500
501
502
503
504
505
506<h5>Returns:</h5>
507
508
509<div class="param-desc">
510 <p>this DynamicView object, for further chain ops.</p>
511</div>
512
513
514
515<dl>
516 <dt>
517 Type
518 </dt>
519 <dd>
520
521<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
522
523
524 </dd>
525</dl>
526
527
528
529
530
531
532
533
534
535
536 <h4 class="name" id="applyFind"><span class="type-signature"></span>applyFind<span class="signature">(query, uid<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
537
538
539
540
541
542<div class="description">
543 <p>applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline</p>
544</div>
545
546
547
548
549
550
551
552
553
554 <h5>Parameters:</h5>
555
556
557<table class="params">
558 <thead>
559 <tr>
560
561 <th>Name</th>
562
563
564 <th>Type</th>
565
566
567 <th>Attributes</th>
568
569
570
571
572 <th class="last">Description</th>
573 </tr>
574 </thead>
575
576 <tbody>
577
578
579 <tr>
580
581 <td class="name"><code>query</code></td>
582
583
584 <td class="type">
585
586
587<span class="param-type">object</span>
588
589
590
591 </td>
592
593
594 <td class="attributes">
595
596
597
598
599
600 </td>
601
602
603
604
605 <td class="description last"><p>A mongo-style query object to apply to pipeline</p></td>
606 </tr>
607
608
609
610 <tr>
611
612 <td class="name"><code>uid</code></td>
613
614
615 <td class="type">
616
617
618<span class="param-type">string</span>
619|
620
621<span class="param-type">number</span>
622
623
624
625 </td>
626
627
628 <td class="attributes">
629
630 &lt;optional><br>
631
632
633
634
635
636 </td>
637
638
639
640
641 <td class="description last"><p>Optional: The unique ID of this filter, to reference it in the future.</p></td>
642 </tr>
643
644
645 </tbody>
646</table>
647
648
649
650
651
652
653<dl class="details">
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680 <dt class="tag-source">Source:</dt>
681 <dd class="tag-source"><ul class="dummy"><li>
682 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3638">line 3638</a>
683 </li></ul></dd>
684
685
686
687
688
689
690
691</dl>
692
693
694
695
696
697
698
699
700
701
702
703
704
705<h5>Returns:</h5>
706
707
708<div class="param-desc">
709 <p>this DynamicView object, for further chain ops.</p>
710</div>
711
712
713
714<dl>
715 <dt>
716 Type
717 </dt>
718 <dd>
719
720<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
721
722
723 </dd>
724</dl>
725
726
727
728
729
730
731
732
733
734
735 <h4 class="name" id="applySimpleSort"><span class="type-signature"></span>applySimpleSort<span class="signature">(propname, isdesc<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
736
737
738
739
740
741<div class="description">
742 <p>applySimpleSort() - Used to specify a property used for view translation.</p>
743</div>
744
745
746
747
748
749
750
751
752
753 <h5>Parameters:</h5>
754
755
756<table class="params">
757 <thead>
758 <tr>
759
760 <th>Name</th>
761
762
763 <th>Type</th>
764
765
766 <th>Attributes</th>
767
768
769
770
771 <th class="last">Description</th>
772 </tr>
773 </thead>
774
775 <tbody>
776
777
778 <tr>
779
780 <td class="name"><code>propname</code></td>
781
782
783 <td class="type">
784
785
786<span class="param-type">string</span>
787
788
789
790 </td>
791
792
793 <td class="attributes">
794
795
796
797
798
799 </td>
800
801
802
803
804 <td class="description last"><p>Name of property by which to sort.</p></td>
805 </tr>
806
807
808
809 <tr>
810
811 <td class="name"><code>isdesc</code></td>
812
813
814 <td class="type">
815
816
817<span class="param-type">boolean</span>
818
819
820
821 </td>
822
823
824 <td class="attributes">
825
826 &lt;optional><br>
827
828
829
830
831
832 </td>
833
834
835
836
837 <td class="description last"><p>(Optional) If true, the sort will be in descending order.</p></td>
838 </tr>
839
840
841 </tbody>
842</table>
843
844
845
846
847
848
849<dl class="details">
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876 <dt class="tag-source">Source:</dt>
877 <dd class="tag-source"><ul class="dummy"><li>
878 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3463">line 3463</a>
879 </li></ul></dd>
880
881
882
883
884
885
886
887</dl>
888
889
890
891
892
893
894
895
896
897
898
899
900
901<h5>Returns:</h5>
902
903
904<div class="param-desc">
905 <p>this DynamicView object, for further chain ops.</p>
906</div>
907
908
909
910<dl>
911 <dt>
912 Type
913 </dt>
914 <dd>
915
916<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
917
918
919 </dd>
920</dl>
921
922
923
924
925 <h5>Example</h5>
926
927 <pre class="prettyprint"><code>dv.applySimpleSort("name");</code></pre>
928
929
930
931
932
933
934
935
936 <h4 class="name" id="applySort"><span class="type-signature"></span>applySort<span class="signature">(comparefun)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
937
938
939
940
941
942<div class="description">
943 <p>applySort() - Used to apply a sort to the dynamic view</p>
944</div>
945
946
947
948
949
950
951
952
953
954 <h5>Parameters:</h5>
955
956
957<table class="params">
958 <thead>
959 <tr>
960
961 <th>Name</th>
962
963
964 <th>Type</th>
965
966
967
968
969
970 <th class="last">Description</th>
971 </tr>
972 </thead>
973
974 <tbody>
975
976
977 <tr>
978
979 <td class="name"><code>comparefun</code></td>
980
981
982 <td class="type">
983
984
985<span class="param-type">function</span>
986
987
988
989 </td>
990
991
992
993
994
995 <td class="description last"><p>a javascript compare function used for sorting</p></td>
996 </tr>
997
998
999 </tbody>
1000</table>
1001
1002
1003
1004
1005
1006
1007<dl class="details">
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034 <dt class="tag-source">Source:</dt>
1035 <dd class="tag-source"><ul class="dummy"><li>
1036 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3444">line 3444</a>
1037 </li></ul></dd>
1038
1039
1040
1041
1042
1043
1044
1045</dl>
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059<h5>Returns:</h5>
1060
1061
1062<div class="param-desc">
1063 <p>this DynamicView object, for further chain ops.</p>
1064</div>
1065
1066
1067
1068<dl>
1069 <dt>
1070 Type
1071 </dt>
1072 <dd>
1073
1074<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
1075
1076
1077 </dd>
1078</dl>
1079
1080
1081
1082
1083 <h5>Example</h5>
1084
1085 <pre class="prettyprint"><code>dv.applySort(function(obj1, obj2) { if (obj1.name === obj2.name) return 0; if (obj1.name > obj2.name) return 1; if (obj1.name &lt; obj2.name) return -1; });</code></pre>
1086
1087
1088
1089
1090
1091
1092
1093
1094 <h4 class="name" id="applySortCriteria"><span class="type-signature"></span>applySortCriteria<span class="signature">(properties)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
1095
1096
1097
1098
1099
1100<div class="description">
1101 <p>applySortCriteria() - Allows sorting a resultset based on multiple columns.</p>
1102</div>
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112 <h5>Parameters:</h5>
1113
1114
1115<table class="params">
1116 <thead>
1117 <tr>
1118
1119 <th>Name</th>
1120
1121
1122 <th>Type</th>
1123
1124
1125
1126
1127
1128 <th class="last">Description</th>
1129 </tr>
1130 </thead>
1131
1132 <tbody>
1133
1134
1135 <tr>
1136
1137 <td class="name"><code>properties</code></td>
1138
1139
1140 <td class="type">
1141
1142
1143<span class="param-type">array</span>
1144
1145
1146
1147 </td>
1148
1149
1150
1151
1152
1153 <td class="description last"><p>array of property names or subarray of [propertyname, isdesc] used evaluate sort order</p></td>
1154 </tr>
1155
1156
1157 </tbody>
1158</table>
1159
1160
1161
1162
1163
1164
1165<dl class="details">
1166
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 <dt class="tag-source">Source:</dt>
1193 <dd class="tag-source"><ul class="dummy"><li>
1194 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3488">line 3488</a>
1195 </li></ul></dd>
1196
1197
1198
1199
1200
1201
1202
1203</dl>
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217<h5>Returns:</h5>
1218
1219
1220<div class="param-desc">
1221 <p>Reference to this DynamicView, sorted, for future chain operations.</p>
1222</div>
1223
1224
1225
1226<dl>
1227 <dt>
1228 Type
1229 </dt>
1230 <dd>
1231
1232<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
1233
1234
1235 </dd>
1236</dl>
1237
1238
1239
1240
1241 <h5>Example</h5>
1242
1243 <pre class="prettyprint"><code>// to sort by age and then name (both ascending) dv.applySortCriteria(['age', 'name']); // to sort by age (ascending) and then by name (descending) dv.applySortCriteria(['age', ['name', true]); // to sort by age (descending) and then by name (descending) dv.applySortCriteria(['age', true], ['name', true]);</code></pre>
1244
1245
1246
1247
1248
1249
1250
1251
1252 <h4 class="name" id="applyWhere"><span class="type-signature"></span>applyWhere<span class="signature">(fun, uid<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
1253
1254
1255
1256
1257
1258<div class="description">
1259 <p>applyWhere() - Adds or updates a javascript filter function in the DynamicView filter pipeline</p>
1260</div>
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270 <h5>Parameters:</h5>
1271
1272
1273<table class="params">
1274 <thead>
1275 <tr>
1276
1277 <th>Name</th>
1278
1279
1280 <th>Type</th>
1281
1282
1283 <th>Attributes</th>
1284
1285
1286
1287
1288 <th class="last">Description</th>
1289 </tr>
1290 </thead>
1291
1292 <tbody>
1293
1294
1295 <tr>
1296
1297 <td class="name"><code>fun</code></td>
1298
1299
1300 <td class="type">
1301
1302
1303<span class="param-type">function</span>
1304
1305
1306
1307 </td>
1308
1309
1310 <td class="attributes">
1311
1312
1313
1314
1315
1316 </td>
1317
1318
1319
1320
1321 <td class="description last"><p>A javascript filter function to apply to pipeline</p></td>
1322 </tr>
1323
1324
1325
1326 <tr>
1327
1328 <td class="name"><code>uid</code></td>
1329
1330
1331 <td class="type">
1332
1333
1334<span class="param-type">string</span>
1335|
1336
1337<span class="param-type">number</span>
1338
1339
1340
1341 </td>
1342
1343
1344 <td class="attributes">
1345
1346 &lt;optional><br>
1347
1348
1349
1350
1351
1352 </td>
1353
1354
1355
1356
1357 <td class="description last"><p>Optional: The unique ID of this filter, to reference it in the future.</p></td>
1358 </tr>
1359
1360
1361 </tbody>
1362</table>
1363
1364
1365
1366
1367
1368
1369<dl class="details">
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396 <dt class="tag-source">Source:</dt>
1397 <dd class="tag-source"><ul class="dummy"><li>
1398 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3655">line 3655</a>
1399 </li></ul></dd>
1400
1401
1402
1403
1404
1405
1406
1407</dl>
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421<h5>Returns:</h5>
1422
1423
1424<div class="param-desc">
1425 <p>this DynamicView object, for further chain ops.</p>
1426</div>
1427
1428
1429
1430<dl>
1431 <dt>
1432 Type
1433 </dt>
1434 <dd>
1435
1436<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
1437
1438
1439 </dd>
1440</dl>
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451 <h4 class="name" id="branchResultset"><span class="type-signature"></span>branchResultset<span class="signature">(transform, parameters<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Resultset.html">Resultset</a>}</span></h4>
1452
1453
1454
1455
1456
1457<div class="description">
1458 <p>branchResultset() - Makes a copy of the internal resultset for branched queries.
1459 Unlike this dynamic view, the branched resultset will not be 'live' updated,
1460 so your branched query should be immediately resolved and not held for future evaluation.</p>
1461</div>
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471 <h5>Parameters:</h5>
1472
1473
1474<table class="params">
1475 <thead>
1476 <tr>
1477
1478 <th>Name</th>
1479
1480
1481 <th>Type</th>
1482
1483
1484 <th>Attributes</th>
1485
1486
1487
1488
1489 <th class="last">Description</th>
1490 </tr>
1491 </thead>
1492
1493 <tbody>
1494
1495
1496 <tr>
1497
1498 <td class="name"><code>transform</code></td>
1499
1500
1501 <td class="type">
1502
1503
1504<span class="param-type">string</span>
1505|
1506
1507<span class="param-type">array</span>
1508
1509
1510
1511 </td>
1512
1513
1514 <td class="attributes">
1515
1516
1517
1518
1519
1520 </td>
1521
1522
1523
1524
1525 <td class="description last"><p>Optional name of collection transform, or an array of transform steps</p></td>
1526 </tr>
1527
1528
1529
1530 <tr>
1531
1532 <td class="name"><code>parameters</code></td>
1533
1534
1535 <td class="type">
1536
1537
1538<span class="param-type">object</span>
1539
1540
1541
1542 </td>
1543
1544
1545 <td class="attributes">
1546
1547 &lt;optional><br>
1548
1549
1550
1551
1552
1553 </td>
1554
1555
1556
1557
1558 <td class="description last"><p>optional parameters (if optional transform requires them)</p></td>
1559 </tr>
1560
1561
1562 </tbody>
1563</table>
1564
1565
1566
1567
1568
1569
1570<dl class="details">
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597 <dt class="tag-source">Source:</dt>
1598 <dd class="tag-source"><ul class="dummy"><li>
1599 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3377">line 3377</a>
1600 </li></ul></dd>
1601
1602
1603
1604
1605
1606
1607
1608</dl>
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622<h5>Returns:</h5>
1623
1624
1625<div class="param-desc">
1626 <p>A copy of the internal resultset for branched queries.</p>
1627</div>
1628
1629
1630
1631<dl>
1632 <dt>
1633 Type
1634 </dt>
1635 <dd>
1636
1637<span class="param-type"><a href="Resultset.html">Resultset</a></span>
1638
1639
1640 </dd>
1641</dl>
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652 <h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
1653
1654
1655
1656
1657
1658<div class="description">
1659 <p>count() - returns the number of documents representing the current DynamicView contents.</p>
1660</div>
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674<dl class="details">
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701 <dt class="tag-source">Source:</dt>
1702 <dd class="tag-source"><ul class="dummy"><li>
1703 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3688">line 3688</a>
1704 </li></ul></dd>
1705
1706
1707
1708
1709
1710
1711
1712</dl>
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726<h5>Returns:</h5>
1727
1728
1729<div class="param-desc">
1730 <p>The number of documents representing the current DynamicView contents.</p>
1731</div>
1732
1733
1734
1735<dl>
1736 <dt>
1737 Type
1738 </dt>
1739 <dd>
1740
1741<span class="param-type">number</span>
1742
1743
1744 </dd>
1745</dl>
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756 <h4 class="name" id="data"><span class="type-signature"></span>data<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4>
1757
1758
1759
1760
1761
1762<div class="description">
1763 <p>data() - resolves and pending filtering and sorting, then returns document array as result.</p>
1764</div>
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778<dl class="details">
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805 <dt class="tag-source">Source:</dt>
1806 <dd class="tag-source"><ul class="dummy"><li>
1807 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3701">line 3701</a>
1808 </li></ul></dd>
1809
1810
1811
1812
1813
1814
1815
1816</dl>
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830<h5>Returns:</h5>
1831
1832
1833<div class="param-desc">
1834 <p>An array of documents representing the current DynamicView contents.</p>
1835</div>
1836
1837
1838
1839<dl>
1840 <dt>
1841 Type
1842 </dt>
1843 <dd>
1844
1845<span class="param-type">array</span>
1846
1847
1848 </dd>
1849</dl>
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860 <h4 class="name" id="mapReduce"><span class="type-signature"></span>mapReduce<span class="signature">(mapFunction, reduceFunction)</span><span class="type-signature"></span></h4>
1861
1862
1863
1864
1865
1866<div class="description">
1867 <p>mapReduce() - data transformation via user supplied functions</p>
1868</div>
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878 <h5>Parameters:</h5>
1879
1880
1881<table class="params">
1882 <thead>
1883 <tr>
1884
1885 <th>Name</th>
1886
1887
1888 <th>Type</th>
1889
1890
1891
1892
1893
1894 <th class="last">Description</th>
1895 </tr>
1896 </thead>
1897
1898 <tbody>
1899
1900
1901 <tr>
1902
1903 <td class="name"><code>mapFunction</code></td>
1904
1905
1906 <td class="type">
1907
1908
1909<span class="param-type">function</span>
1910
1911
1912
1913 </td>
1914
1915
1916
1917
1918
1919 <td class="description last"><p>this function accepts a single document for you to transform and return</p></td>
1920 </tr>
1921
1922
1923
1924 <tr>
1925
1926 <td class="name"><code>reduceFunction</code></td>
1927
1928
1929 <td class="type">
1930
1931
1932<span class="param-type">function</span>
1933
1934
1935
1936 </td>
1937
1938
1939
1940
1941
1942 <td class="description last"><p>this function accepts many (array of map outputs) and returns single value</p></td>
1943 </tr>
1944
1945
1946 </tbody>
1947</table>
1948
1949
1950
1951
1952
1953
1954<dl class="details">
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981 <dt class="tag-source">Source:</dt>
1982 <dd class="tag-source"><ul class="dummy"><li>
1983 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3963">line 3963</a>
1984 </li></ul></dd>
1985
1986
1987
1988
1989
1990
1991
1992</dl>
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006<h5>Returns:</h5>
2007
2008
2009<div class="param-desc">
2010 <p>The output of your reduceFunction</p>
2011</div>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024 <h4 class="name" id="rematerialize"><span class="type-signature"></span>rematerialize<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
2025
2026
2027
2028
2029
2030<div class="description">
2031 <p>rematerialize() - intended for use immediately after deserialization (loading)
2032 This will clear out and reapply filterPipeline ops, recreating the view.
2033 Since where filters do not persist correctly, this method allows
2034 restoring the view to state where user can re-apply those where filters.</p>
2035</div>
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045 <h5>Parameters:</h5>
2046
2047
2048<table class="params">
2049 <thead>
2050 <tr>
2051
2052 <th>Name</th>
2053
2054
2055 <th>Type</th>
2056
2057
2058 <th>Attributes</th>
2059
2060
2061
2062
2063 <th class="last">Description</th>
2064 </tr>
2065 </thead>
2066
2067 <tbody>
2068
2069
2070 <tr>
2071
2072 <td class="name"><code>options</code></td>
2073
2074
2075 <td class="type">
2076
2077
2078<span class="param-type">Object</span>
2079
2080
2081
2082 </td>
2083
2084
2085 <td class="attributes">
2086
2087 &lt;optional><br>
2088
2089
2090
2091
2092
2093 </td>
2094
2095
2096
2097
2098 <td class="description last"><p>(Optional) allows specification of 'removeWhereFilters' option</p></td>
2099 </tr>
2100
2101
2102 </tbody>
2103</table>
2104
2105
2106
2107
2108
2109
2110<dl class="details">
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137 <dt class="tag-source">Source:</dt>
2138 <dd class="tag-source"><ul class="dummy"><li>
2139 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3317">line 3317</a>
2140 </li></ul></dd>
2141
2142
2143
2144
2145
2146
2147
2148</dl>
2149
2150
2151
2152
2153
2154<h5>Fires:</h5>
2155<ul>
2156 <li>DynamicView.event:rebuild</li>
2157</ul>
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167<h5>Returns:</h5>
2168
2169
2170<div class="param-desc">
2171 <p>This dynamic view for further chained ops.</p>
2172</div>
2173
2174
2175
2176<dl>
2177 <dt>
2178 Type
2179 </dt>
2180 <dd>
2181
2182<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
2183
2184
2185 </dd>
2186</dl>
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197 <h4 class="name" id="removeFilter"><span class="type-signature"></span>removeFilter<span class="signature">(uid)</span><span class="type-signature"> &rarr; {<a href="DynamicView.html">DynamicView</a>}</span></h4>
2198
2199
2200
2201
2202
2203<div class="description">
2204 <p>removeFilter() - Remove the specified filter from the DynamicView filter pipeline</p>
2205</div>
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215 <h5>Parameters:</h5>
2216
2217
2218<table class="params">
2219 <thead>
2220 <tr>
2221
2222 <th>Name</th>
2223
2224
2225 <th>Type</th>
2226
2227
2228
2229
2230
2231 <th class="last">Description</th>
2232 </tr>
2233 </thead>
2234
2235 <tbody>
2236
2237
2238 <tr>
2239
2240 <td class="name"><code>uid</code></td>
2241
2242
2243 <td class="type">
2244
2245
2246<span class="param-type">string</span>
2247|
2248
2249<span class="param-type">number</span>
2250
2251
2252
2253 </td>
2254
2255
2256
2257
2258
2259 <td class="description last"><p>The unique ID of the filter to be removed.</p></td>
2260 </tr>
2261
2262
2263 </tbody>
2264</table>
2265
2266
2267
2268
2269
2270
2271<dl class="details">
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298 <dt class="tag-source">Source:</dt>
2299 <dd class="tag-source"><ul class="dummy"><li>
2300 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3671">line 3671</a>
2301 </li></ul></dd>
2302
2303
2304
2305
2306
2307
2308
2309</dl>
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323<h5>Returns:</h5>
2324
2325
2326<div class="param-desc">
2327 <p>this DynamicView object, for further chain ops.</p>
2328</div>
2329
2330
2331
2332<dl>
2333 <dt>
2334 Type
2335 </dt>
2336 <dd>
2337
2338<span class="param-type"><a href="DynamicView.html">DynamicView</a></span>
2339
2340
2341 </dd>
2342</dl>
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353 <h4 class="name" id="removeFilters"><span class="type-signature"></span>removeFilters<span class="signature">()</span><span class="type-signature"></span></h4>
2354
2355
2356
2357
2358
2359<div class="description">
2360 <p>removeFilters() - Used to clear pipeline and reset dynamic view to initial state.
2361 Existing options should be retained.</p>
2362</div>
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376<dl class="details">
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403 <dt class="tag-source">Source:</dt>
2404 <dd class="tag-source"><ul class="dummy"><li>
2405 <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3413">line 3413</a>
2406 </li></ul></dd>
2407
2408
2409
2410
2411
2412
2413
2414</dl>
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437</article>
2438
2439</section>
2440
2441
2442
2443
2444</div>
2445
2446<nav>
2447 <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Collection.html">Collection</a></li><li><a href="DynamicView.html">DynamicView</a></li><li><a href="Loki.html">Loki</a></li><li><a href="LokiEventEmitter.html">LokiEventEmitter</a></li><li><a href="LokiFsAdapter.html">LokiFsAdapter</a></li><li><a href="LokiFsStructuredAdapter.html">LokiFsStructuredAdapter</a></li><li><a href="LokiIndexedAdapter.html">LokiIndexedAdapter</a></li><li><a href="LokiLocalStorageAdapter.html">LokiLocalStorageAdapter</a></li><li><a href="LokiMemoryAdapter.html">LokiMemoryAdapter</a></li><li><a href="LokiPartitioningAdapter.html">LokiPartitioningAdapter</a></li><li><a href="Resultset.html">Resultset</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-Autoupdating Collections.html">Autoupdating Collections</a></li><li><a href="tutorial-Changes API.html">Changes API</a></li><li><a href="tutorial-Collection Transforms.html">Collection Transforms</a></li><li><a href="tutorial-Indexing and Query performance.html">Indexing and Query performance</a></li><li><a href="tutorial-Loki Angular.html">Loki Angular</a></li><li><a href="tutorial-Persistence Adapters.html">Persistence Adapters</a></li><li><a href="tutorial-Query Examples.html">Query Examples</a></li></ul>
2448</nav>
2449
2450<br class="clear">
2451
2452<footer>
2453 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun Dec 18 2016 19:39:52 GMT-0500 (Eastern Standard Time)
2454</footer>
2455
2456<script> prettyPrint(); </script>
2457<script src="scripts/linenumber.js"> </script>
2458</body>
2459</html>
\No newline at end of file