1 | <!DOCTYPE html>
|
2 | <html lang="en">
|
3 | <head>
|
4 | <meta charset="utf-8">
|
5 | <title>JSDoc: Class: Resultset</title>
|
6 |
|
7 | <script src="scripts/prettify/prettify.js"> </script>
|
8 | <script src="scripts/prettify/lang-css.js"> </script>
|
9 | |
10 |
|
11 |
|
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: Resultset</h1>
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | <section>
|
28 |
|
29 | <header>
|
30 |
|
31 | <h2>Resultset</h2>
|
32 |
|
33 |
|
34 | </header>
|
35 |
|
36 | <article>
|
37 | <div class="container-overview">
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | <h4 class="name" id="Resultset"><span class="type-signature"></span>new Resultset<span class="signature">(collection, 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>Resultset class allowing chainable queries. Intended to be instanced internally.
|
51 | Collection.find(), Collection.where(), and Collection.chain() instantiate this.</p>
|
52 | </div>
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | <h5>Parameters:</h5>
|
63 |
|
64 |
|
65 | <table class="params">
|
66 | <thead>
|
67 | <tr>
|
68 |
|
69 | <th>Name</th>
|
70 |
|
71 |
|
72 | <th>Type</th>
|
73 |
|
74 |
|
75 | <th>Attributes</th>
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | <th class="last">Description</th>
|
81 | </tr>
|
82 | </thead>
|
83 |
|
84 | <tbody>
|
85 |
|
86 |
|
87 | <tr>
|
88 |
|
89 | <td class="name"><code>collection</code></td>
|
90 |
|
91 |
|
92 | <td class="type">
|
93 |
|
94 |
|
95 | <span class="param-type"><a href="Collection.html">Collection</a></span>
|
96 |
|
97 |
|
98 |
|
99 | </td>
|
100 |
|
101 |
|
102 | <td class="attributes">
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | </td>
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | <td class="description last"><p>The collection which this Resultset will query against.</p></td>
|
114 | </tr>
|
115 |
|
116 |
|
117 |
|
118 | <tr>
|
119 |
|
120 | <td class="name"><code>options</code></td>
|
121 |
|
122 |
|
123 | <td class="type">
|
124 |
|
125 |
|
126 | <span class="param-type">Object</span>
|
127 |
|
128 |
|
129 |
|
130 | </td>
|
131 |
|
132 |
|
133 | <td class="attributes">
|
134 |
|
135 | <optional><br>
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | </td>
|
142 |
|
143 |
|
144 |
|
145 |
|
146 | <td class="description last"><p>Object containing one or more options.</p>
|
147 | <h6>Properties</h6>
|
148 |
|
149 |
|
150 | <table class="params">
|
151 | <thead>
|
152 | <tr>
|
153 |
|
154 | <th>Name</th>
|
155 |
|
156 |
|
157 | <th>Type</th>
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | <th class="last">Description</th>
|
164 | </tr>
|
165 | </thead>
|
166 |
|
167 | <tbody>
|
168 |
|
169 |
|
170 | <tr>
|
171 |
|
172 | <td class="name"><code>queryObj</code></td>
|
173 |
|
174 |
|
175 | <td class="type">
|
176 |
|
177 |
|
178 | <span class="param-type">string</span>
|
179 |
|
180 |
|
181 |
|
182 | </td>
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | <td class="description last"><p>Optional mongo-style query object to initialize resultset with.</p></td>
|
189 | </tr>
|
190 |
|
191 |
|
192 |
|
193 | <tr>
|
194 |
|
195 | <td class="name"><code>queryFunc</code></td>
|
196 |
|
197 |
|
198 | <td class="type">
|
199 |
|
200 |
|
201 | <span class="param-type">function</span>
|
202 |
|
203 |
|
204 |
|
205 | </td>
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 | <td class="description last"><p>Optional javascript filter function to initialize resultset with.</p></td>
|
212 | </tr>
|
213 |
|
214 |
|
215 |
|
216 | <tr>
|
217 |
|
218 | <td class="name"><code>firstOnly</code></td>
|
219 |
|
220 |
|
221 | <td class="type">
|
222 |
|
223 |
|
224 | <span class="param-type">bool</span>
|
225 |
|
226 |
|
227 |
|
228 | </td>
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 | <td class="description last"><p>Optional boolean used by collection.findOne().</p></td>
|
235 | </tr>
|
236 |
|
237 |
|
238 | </tbody>
|
239 | </table>
|
240 |
|
241 | </td>
|
242 | </tr>
|
243 |
|
244 |
|
245 | </tbody>
|
246 | </table>
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 | <dl class="details">
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 | <dt class="tag-source">Source:</dt>
|
281 | <dd class="tag-source"><ul class="dummy"><li>
|
282 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2280">line 2280</a>
|
283 | </li></ul></dd>
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 | </dl>
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 | <h5>Example</h5>
|
308 |
|
309 | <pre class="prettyprint"><code>mycollection.chain()
.find({ 'doors' : 4 })
.where(function(obj) { return obj.name === 'Toyota' })
.data();</code></pre>
|
310 |
|
311 |
|
312 |
|
313 |
|
314 | </div>
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 | <h3 class="subsection-title">Members</h3>
|
328 |
|
329 |
|
330 |
|
331 | <h4 class="name" id="branch"><span class="type-signature"></span>branch<span class="type-signature"></span></h4>
|
332 |
|
333 |
|
334 |
|
335 |
|
336 | <div class="description">
|
337 | <p>Alias of copy()</p>
|
338 | </div>
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 | <dl class="details">
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 | <dt class="tag-source">Source:</dt>
|
374 | <dd class="tag-source"><ul class="dummy"><li>
|
375 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2407">line 2407</a>
|
376 | </li></ul></dd>
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 | </dl>
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 | <h3 class="subsection-title">Methods</h3>
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 | <h4 class="name" id="compoundsort"><span class="type-signature"></span>compoundsort<span class="signature">(properties)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | <div class="description">
|
409 | <p>Allows sorting a resultset based on multiple columns.</p>
|
410 | </div>
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 | <h5>Parameters:</h5>
|
421 |
|
422 |
|
423 | <table class="params">
|
424 | <thead>
|
425 | <tr>
|
426 |
|
427 | <th>Name</th>
|
428 |
|
429 |
|
430 | <th>Type</th>
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 | <th class="last">Description</th>
|
437 | </tr>
|
438 | </thead>
|
439 |
|
440 | <tbody>
|
441 |
|
442 |
|
443 | <tr>
|
444 |
|
445 | <td class="name"><code>properties</code></td>
|
446 |
|
447 |
|
448 | <td class="type">
|
449 |
|
450 |
|
451 | <span class="param-type">array</span>
|
452 |
|
453 |
|
454 |
|
455 | </td>
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 | <td class="description last"><p>array of property names or subarray of [propertyname, isdesc] used evaluate sort order</p></td>
|
462 | </tr>
|
463 |
|
464 |
|
465 | </tbody>
|
466 | </table>
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | <dl class="details">
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | <dt class="tag-source">Source:</dt>
|
501 | <dd class="tag-source"><ul class="dummy"><li>
|
502 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2562">line 2562</a>
|
503 | </li></ul></dd>
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 | </dl>
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 | <h5>Returns:</h5>
|
526 |
|
527 |
|
528 | <div class="param-desc">
|
529 | <p>Reference to this resultset, sorted, for future chain operations.</p>
|
530 | </div>
|
531 |
|
532 |
|
533 |
|
534 | <dl>
|
535 | <dt>
|
536 | Type
|
537 | </dt>
|
538 | <dd>
|
539 |
|
540 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
541 |
|
542 |
|
543 | </dd>
|
544 | </dl>
|
545 |
|
546 |
|
547 |
|
548 |
|
549 | <h5>Example</h5>
|
550 |
|
551 | <pre class="prettyprint"><code>// to sort by age and then name (both ascending)
rs.compoundsort(['age', 'name']);
// to sort by age (ascending) and then by name (descending)
rs.compoundsort(['age', ['name', true]);</code></pre>
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 | <h4 class="name" id="copy"><span class="type-signature"></span>copy<span class="signature">()</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 | <div class="description">
|
567 | <p>copy() - To support reuse of resultset in branched query situations.</p>
|
568 | </div>
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 | <dl class="details">
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 | <dt class="tag-source">Source:</dt>
|
610 | <dd class="tag-source"><ul class="dummy"><li>
|
611 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2392">line 2392</a>
|
612 | </li></ul></dd>
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 | </dl>
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 | <h5>Returns:</h5>
|
635 |
|
636 |
|
637 | <div class="param-desc">
|
638 | <p>Returns a copy of the resultset (set) but the underlying document references will be the same.</p>
|
639 | </div>
|
640 |
|
641 |
|
642 |
|
643 | <dl>
|
644 | <dt>
|
645 | Type
|
646 | </dt>
|
647 | <dd>
|
648 |
|
649 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
650 |
|
651 |
|
652 | </dd>
|
653 | </dl>
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 | <h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> → {number}</span></h4>
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 | <div class="description">
|
671 | <p>count() - returns the number of documents in the resultset.</p>
|
672 | </div>
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 | <dl class="details">
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | <dt class="tag-source">Source:</dt>
|
714 | <dd class="tag-source"><ul class="dummy"><li>
|
715 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3025">line 3025</a>
|
716 | </li></ul></dd>
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 | </dl>
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 | <h5>Returns:</h5>
|
739 |
|
740 |
|
741 | <div class="param-desc">
|
742 | <p>The number of documents in the resultset.</p>
|
743 | </div>
|
744 |
|
745 |
|
746 |
|
747 | <dl>
|
748 | <dt>
|
749 | Type
|
750 | </dt>
|
751 | <dd>
|
752 |
|
753 | <span class="param-type">number</span>
|
754 |
|
755 |
|
756 | </dd>
|
757 | </dl>
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 | <h4 class="name" id="data"><span class="type-signature"></span>data<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {array}</span></h4>
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 | <div class="description">
|
775 | <p>Terminates the chain and returns array of filtered documents</p>
|
776 | </div>
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 | <h5>Parameters:</h5>
|
787 |
|
788 |
|
789 | <table class="params">
|
790 | <thead>
|
791 | <tr>
|
792 |
|
793 | <th>Name</th>
|
794 |
|
795 |
|
796 | <th>Type</th>
|
797 |
|
798 |
|
799 | <th>Attributes</th>
|
800 |
|
801 |
|
802 |
|
803 |
|
804 | <th class="last">Description</th>
|
805 | </tr>
|
806 | </thead>
|
807 |
|
808 | <tbody>
|
809 |
|
810 |
|
811 | <tr>
|
812 |
|
813 | <td class="name"><code>options</code></td>
|
814 |
|
815 |
|
816 | <td class="type">
|
817 |
|
818 |
|
819 | <span class="param-type">object</span>
|
820 |
|
821 |
|
822 |
|
823 | </td>
|
824 |
|
825 |
|
826 | <td class="attributes">
|
827 |
|
828 | <optional><br>
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 | </td>
|
835 |
|
836 |
|
837 |
|
838 |
|
839 | <td class="description last"><p>allows specifying 'forceClones' and 'forceCloneMethod' options.</p>
|
840 | <h6>Properties</h6>
|
841 |
|
842 |
|
843 | <table class="params">
|
844 | <thead>
|
845 | <tr>
|
846 |
|
847 | <th>Name</th>
|
848 |
|
849 |
|
850 | <th>Type</th>
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 | <th class="last">Description</th>
|
857 | </tr>
|
858 | </thead>
|
859 |
|
860 | <tbody>
|
861 |
|
862 |
|
863 | <tr>
|
864 |
|
865 | <td class="name"><code>forceClones</code></td>
|
866 |
|
867 |
|
868 | <td class="type">
|
869 |
|
870 |
|
871 | <span class="param-type">boolean</span>
|
872 |
|
873 |
|
874 |
|
875 | </td>
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 | <td class="description last"><p>Allows forcing the return of cloned objects even when
|
882 | the collection is not configured for clone object.</p></td>
|
883 | </tr>
|
884 |
|
885 |
|
886 |
|
887 | <tr>
|
888 |
|
889 | <td class="name"><code>forceCloneMethod</code></td>
|
890 |
|
891 |
|
892 | <td class="type">
|
893 |
|
894 |
|
895 | <span class="param-type">string</span>
|
896 |
|
897 |
|
898 |
|
899 | </td>
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 | <td class="description last"><p>Allows overriding the default or collection specified cloning method.
|
906 | Possible values include 'parse-stringify', 'jquery-extend-deep', and 'shallow'</p></td>
|
907 | </tr>
|
908 |
|
909 |
|
910 | </tbody>
|
911 | </table>
|
912 |
|
913 | </td>
|
914 | </tr>
|
915 |
|
916 |
|
917 | </tbody>
|
918 | </table>
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 | <dl class="details">
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 | <dt class="tag-source">Source:</dt>
|
953 | <dd class="tag-source"><ul class="dummy"><li>
|
954 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3044">line 3044</a>
|
955 | </li></ul></dd>
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 | </dl>
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 | <h5>Returns:</h5>
|
978 |
|
979 |
|
980 | <div class="param-desc">
|
981 | <p>Array of documents in the resultset</p>
|
982 | </div>
|
983 |
|
984 |
|
985 |
|
986 | <dl>
|
987 | <dt>
|
988 | Type
|
989 | </dt>
|
990 | <dd>
|
991 |
|
992 | <span class="param-type">array</span>
|
993 |
|
994 |
|
995 | </dd>
|
996 | </dl>
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 | <h4 class="name" id="eqJoin"><span class="type-signature"></span>eqJoin<span class="signature">(joinData, leftJoinKey, rightJoinKey, mapFun<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 | <div class="description">
|
1014 | <p>eqJoin() - Left joining two sets of data. Join keys can be defined or calculated properties
|
1015 | eqJoin expects the right join key values to be unique. Otherwise left data will be joined on the last joinData object with that key</p>
|
1016 | </div>
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 | <h5>Parameters:</h5>
|
1027 |
|
1028 |
|
1029 | <table class="params">
|
1030 | <thead>
|
1031 | <tr>
|
1032 |
|
1033 | <th>Name</th>
|
1034 |
|
1035 |
|
1036 | <th>Type</th>
|
1037 |
|
1038 |
|
1039 | <th>Attributes</th>
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 | <th class="last">Description</th>
|
1045 | </tr>
|
1046 | </thead>
|
1047 |
|
1048 | <tbody>
|
1049 |
|
1050 |
|
1051 | <tr>
|
1052 |
|
1053 | <td class="name"><code>joinData</code></td>
|
1054 |
|
1055 |
|
1056 | <td class="type">
|
1057 |
|
1058 |
|
1059 | <span class="param-type">Array</span>
|
1060 |
|
1061 |
|
1062 |
|
1063 | </td>
|
1064 |
|
1065 |
|
1066 | <td class="attributes">
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 | </td>
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 | <td class="description last"><p>Data array to join to.</p></td>
|
1078 | </tr>
|
1079 |
|
1080 |
|
1081 |
|
1082 | <tr>
|
1083 |
|
1084 | <td class="name"><code>leftJoinKey</code></td>
|
1085 |
|
1086 |
|
1087 | <td class="type">
|
1088 |
|
1089 |
|
1090 | <span class="param-type">string</span>
|
1091 | |
|
1092 |
|
1093 | <span class="param-type">function</span>
|
1094 |
|
1095 |
|
1096 |
|
1097 | </td>
|
1098 |
|
1099 |
|
1100 | <td class="attributes">
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 | </td>
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 | <td class="description last"><p>Property name in this result set to join on or a function to produce a value to join on</p></td>
|
1112 | </tr>
|
1113 |
|
1114 |
|
1115 |
|
1116 | <tr>
|
1117 |
|
1118 | <td class="name"><code>rightJoinKey</code></td>
|
1119 |
|
1120 |
|
1121 | <td class="type">
|
1122 |
|
1123 |
|
1124 | <span class="param-type">string</span>
|
1125 | |
|
1126 |
|
1127 | <span class="param-type">function</span>
|
1128 |
|
1129 |
|
1130 |
|
1131 | </td>
|
1132 |
|
1133 |
|
1134 | <td class="attributes">
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 | </td>
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 | <td class="description last"><p>Property name in the joinData to join on or a function to produce a value to join on</p></td>
|
1146 | </tr>
|
1147 |
|
1148 |
|
1149 |
|
1150 | <tr>
|
1151 |
|
1152 | <td class="name"><code>mapFun</code></td>
|
1153 |
|
1154 |
|
1155 | <td class="type">
|
1156 |
|
1157 |
|
1158 | <span class="param-type">function</span>
|
1159 |
|
1160 |
|
1161 |
|
1162 | </td>
|
1163 |
|
1164 |
|
1165 | <td class="attributes">
|
1166 |
|
1167 | <optional><br>
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 | </td>
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 | <td class="description last"><p>(Optional) A function that receives each matching pair and maps them into output objects - function(left,right){return joinedObject}</p></td>
|
1179 | </tr>
|
1180 |
|
1181 |
|
1182 | </tbody>
|
1183 | </table>
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 | <dl class="details">
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 | <dt class="tag-source">Source:</dt>
|
1218 | <dd class="tag-source"><ul class="dummy"><li>
|
1219 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3170">line 3170</a>
|
1220 | </li></ul></dd>
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 | </dl>
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 | <h5>Returns:</h5>
|
1243 |
|
1244 |
|
1245 | <div class="param-desc">
|
1246 | <p>A resultset with data in the format [{left: leftObj, right: rightObj}]</p>
|
1247 | </div>
|
1248 |
|
1249 |
|
1250 |
|
1251 | <dl>
|
1252 | <dt>
|
1253 | Type
|
1254 | </dt>
|
1255 | <dd>
|
1256 |
|
1257 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
1258 |
|
1259 |
|
1260 | </dd>
|
1261 | </dl>
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 | <h4 class="name" id="find"><span class="type-signature"></span>find<span class="signature">(query, firstOnly<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 | <div class="description">
|
1279 | <p>Used for querying via a mongo-style query object.</p>
|
1280 | </div>
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 | <h5>Parameters:</h5>
|
1291 |
|
1292 |
|
1293 | <table class="params">
|
1294 | <thead>
|
1295 | <tr>
|
1296 |
|
1297 | <th>Name</th>
|
1298 |
|
1299 |
|
1300 | <th>Type</th>
|
1301 |
|
1302 |
|
1303 | <th>Attributes</th>
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 | <th class="last">Description</th>
|
1309 | </tr>
|
1310 | </thead>
|
1311 |
|
1312 | <tbody>
|
1313 |
|
1314 |
|
1315 | <tr>
|
1316 |
|
1317 | <td class="name"><code>query</code></td>
|
1318 |
|
1319 |
|
1320 | <td class="type">
|
1321 |
|
1322 |
|
1323 | <span class="param-type">object</span>
|
1324 |
|
1325 |
|
1326 |
|
1327 | </td>
|
1328 |
|
1329 |
|
1330 | <td class="attributes">
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 | </td>
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 | <td class="description last"><p>A mongo-style query object used for filtering current results.</p></td>
|
1342 | </tr>
|
1343 |
|
1344 |
|
1345 |
|
1346 | <tr>
|
1347 |
|
1348 | <td class="name"><code>firstOnly</code></td>
|
1349 |
|
1350 |
|
1351 | <td class="type">
|
1352 |
|
1353 |
|
1354 | <span class="param-type">boolean</span>
|
1355 |
|
1356 |
|
1357 |
|
1358 | </td>
|
1359 |
|
1360 |
|
1361 | <td class="attributes">
|
1362 |
|
1363 | <optional><br>
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 | </td>
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 | <td class="description last"><p>(Optional) Used by collection.findOne()</p></td>
|
1375 | </tr>
|
1376 |
|
1377 |
|
1378 | </tbody>
|
1379 | </table>
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 | <dl class="details">
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 | <dt class="tag-source">Source:</dt>
|
1414 | <dd class="tag-source"><ul class="dummy"><li>
|
1415 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2677">line 2677</a>
|
1416 | </li></ul></dd>
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 | </dl>
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 | <h5>Returns:</h5>
|
1439 |
|
1440 |
|
1441 | <div class="param-desc">
|
1442 | <p>this resultset for further chain ops.</p>
|
1443 | </div>
|
1444 |
|
1445 |
|
1446 |
|
1447 | <dl>
|
1448 | <dt>
|
1449 | Type
|
1450 | </dt>
|
1451 | <dd>
|
1452 |
|
1453 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
1454 |
|
1455 |
|
1456 | </dd>
|
1457 | </dl>
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 | <h4 class="name" id="limit"><span class="type-signature"></span>limit<span class="signature">(qty)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 | <div class="description">
|
1475 | <p>Allows you to limit the number of documents passed to next chain operation.
|
1476 | A resultset copy() is made to avoid altering original resultset.</p>
|
1477 | </div>
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 | <h5>Parameters:</h5>
|
1488 |
|
1489 |
|
1490 | <table class="params">
|
1491 | <thead>
|
1492 | <tr>
|
1493 |
|
1494 | <th>Name</th>
|
1495 |
|
1496 |
|
1497 | <th>Type</th>
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 | <th class="last">Description</th>
|
1504 | </tr>
|
1505 | </thead>
|
1506 |
|
1507 | <tbody>
|
1508 |
|
1509 |
|
1510 | <tr>
|
1511 |
|
1512 | <td class="name"><code>qty</code></td>
|
1513 |
|
1514 |
|
1515 | <td class="type">
|
1516 |
|
1517 |
|
1518 | <span class="param-type">int</span>
|
1519 |
|
1520 |
|
1521 |
|
1522 | </td>
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 | <td class="description last"><p>The number of documents to return.</p></td>
|
1529 | </tr>
|
1530 |
|
1531 |
|
1532 | </tbody>
|
1533 | </table>
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 | <dl class="details">
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 | <dt class="tag-source">Source:</dt>
|
1568 | <dd class="tag-source"><ul class="dummy"><li>
|
1569 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2355">line 2355</a>
|
1570 | </li></ul></dd>
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 | </dl>
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 | <h5>Returns:</h5>
|
1593 |
|
1594 |
|
1595 | <div class="param-desc">
|
1596 | <p>Returns a copy of the resultset, limited by qty, for subsequent chain ops.</p>
|
1597 | </div>
|
1598 |
|
1599 |
|
1600 |
|
1601 | <dl>
|
1602 | <dt>
|
1603 | Type
|
1604 | </dt>
|
1605 | <dd>
|
1606 |
|
1607 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
1608 |
|
1609 |
|
1610 | </dd>
|
1611 | </dl>
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 | <h4 class="name" id="mapReduce"><span class="type-signature"></span>mapReduce<span class="signature">(mapFunction, reduceFunction)</span><span class="type-signature"> → {value}</span></h4>
|
1623 |
|
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 | <div class="description">
|
1629 | <p>data transformation via user supplied functions</p>
|
1630 | </div>
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 | <h5>Parameters:</h5>
|
1641 |
|
1642 |
|
1643 | <table class="params">
|
1644 | <thead>
|
1645 | <tr>
|
1646 |
|
1647 | <th>Name</th>
|
1648 |
|
1649 |
|
1650 | <th>Type</th>
|
1651 |
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 | <th class="last">Description</th>
|
1657 | </tr>
|
1658 | </thead>
|
1659 |
|
1660 | <tbody>
|
1661 |
|
1662 |
|
1663 | <tr>
|
1664 |
|
1665 | <td class="name"><code>mapFunction</code></td>
|
1666 |
|
1667 |
|
1668 | <td class="type">
|
1669 |
|
1670 |
|
1671 | <span class="param-type">function</span>
|
1672 |
|
1673 |
|
1674 |
|
1675 | </td>
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 | <td class="description last"><p>this function accepts a single document for you to transform and return</p></td>
|
1682 | </tr>
|
1683 |
|
1684 |
|
1685 |
|
1686 | <tr>
|
1687 |
|
1688 | <td class="name"><code>reduceFunction</code></td>
|
1689 |
|
1690 |
|
1691 | <td class="type">
|
1692 |
|
1693 |
|
1694 | <span class="param-type">function</span>
|
1695 |
|
1696 |
|
1697 |
|
1698 | </td>
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 | <td class="description last"><p>this function accepts many (array of map outputs) and returns single value</p></td>
|
1705 | </tr>
|
1706 |
|
1707 |
|
1708 | </tbody>
|
1709 | </table>
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 | <dl class="details">
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 | <dt class="tag-source">Source:</dt>
|
1744 | <dd class="tag-source"><ul class="dummy"><li>
|
1745 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3152">line 3152</a>
|
1746 | </li></ul></dd>
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 | </dl>
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 | <h5>Returns:</h5>
|
1769 |
|
1770 |
|
1771 | <div class="param-desc">
|
1772 | <p>The output of your reduceFunction</p>
|
1773 | </div>
|
1774 |
|
1775 |
|
1776 |
|
1777 | <dl>
|
1778 | <dt>
|
1779 | Type
|
1780 | </dt>
|
1781 | <dd>
|
1782 |
|
1783 | <span class="param-type">value</span>
|
1784 |
|
1785 |
|
1786 | </dd>
|
1787 | </dl>
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 |
|
1798 | <h4 class="name" id="offset"><span class="type-signature"></span>offset<span class="signature">(pos)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 | <div class="description">
|
1805 | <p>Used for skipping 'pos' number of documents in the resultset.</p>
|
1806 | </div>
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 | <h5>Parameters:</h5>
|
1817 |
|
1818 |
|
1819 | <table class="params">
|
1820 | <thead>
|
1821 | <tr>
|
1822 |
|
1823 | <th>Name</th>
|
1824 |
|
1825 |
|
1826 | <th>Type</th>
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 | <th class="last">Description</th>
|
1833 | </tr>
|
1834 | </thead>
|
1835 |
|
1836 | <tbody>
|
1837 |
|
1838 |
|
1839 | <tr>
|
1840 |
|
1841 | <td class="name"><code>pos</code></td>
|
1842 |
|
1843 |
|
1844 | <td class="type">
|
1845 |
|
1846 |
|
1847 | <span class="param-type">int</span>
|
1848 |
|
1849 |
|
1850 |
|
1851 | </td>
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 | <td class="description last"><p>Number of documents to skip; all preceding documents are filtered out.</p></td>
|
1858 | </tr>
|
1859 |
|
1860 |
|
1861 | </tbody>
|
1862 | </table>
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 | <dl class="details">
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 | <dt class="tag-source">Source:</dt>
|
1897 | <dd class="tag-source"><ul class="dummy"><li>
|
1898 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2374">line 2374</a>
|
1899 | </li></ul></dd>
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 | </dl>
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 | <h5>Returns:</h5>
|
1922 |
|
1923 |
|
1924 | <div class="param-desc">
|
1925 | <p>Returns a copy of the resultset, containing docs starting at 'pos' for subsequent chain ops.</p>
|
1926 | </div>
|
1927 |
|
1928 |
|
1929 |
|
1930 | <dl>
|
1931 | <dt>
|
1932 | Type
|
1933 | </dt>
|
1934 | <dd>
|
1935 |
|
1936 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
1937 |
|
1938 |
|
1939 | </dd>
|
1940 | </dl>
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 | <h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">()</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 | <div class="description">
|
1958 | <p>Removes all document objects which are currently in resultset from collection (as well as resultset)</p>
|
1959 | </div>
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 | <dl class="details">
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 | <dt class="tag-source">Source:</dt>
|
2001 | <dd class="tag-source"><ul class="dummy"><li>
|
2002 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3130">line 3130</a>
|
2003 | </li></ul></dd>
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 | </dl>
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 | <h5>Returns:</h5>
|
2026 |
|
2027 |
|
2028 | <div class="param-desc">
|
2029 | <p>this (empty) resultset for further chain ops.</p>
|
2030 | </div>
|
2031 |
|
2032 |
|
2033 |
|
2034 | <dl>
|
2035 | <dt>
|
2036 | Type
|
2037 | </dt>
|
2038 | <dd>
|
2039 |
|
2040 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
2041 |
|
2042 |
|
2043 | </dd>
|
2044 | </dl>
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 | <h4 class="name" id="simplesort"><span class="type-signature"></span>simplesort<span class="signature">(propname, isdesc<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 | <div class="description">
|
2062 | <p>Simpler, loose evaluation for user to sort based on a property name. (chainable).
|
2063 | Sorting based on the same lt/gt helper functions used for binary indices.</p>
|
2064 | </div>
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 | <h5>Parameters:</h5>
|
2075 |
|
2076 |
|
2077 | <table class="params">
|
2078 | <thead>
|
2079 | <tr>
|
2080 |
|
2081 | <th>Name</th>
|
2082 |
|
2083 |
|
2084 | <th>Type</th>
|
2085 |
|
2086 |
|
2087 | <th>Attributes</th>
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 | <th class="last">Description</th>
|
2093 | </tr>
|
2094 | </thead>
|
2095 |
|
2096 | <tbody>
|
2097 |
|
2098 |
|
2099 | <tr>
|
2100 |
|
2101 | <td class="name"><code>propname</code></td>
|
2102 |
|
2103 |
|
2104 | <td class="type">
|
2105 |
|
2106 |
|
2107 | <span class="param-type">string</span>
|
2108 |
|
2109 |
|
2110 |
|
2111 | </td>
|
2112 |
|
2113 |
|
2114 | <td class="attributes">
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 | </td>
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 | <td class="description last"><p>name of property to sort by.</p></td>
|
2126 | </tr>
|
2127 |
|
2128 |
|
2129 |
|
2130 | <tr>
|
2131 |
|
2132 | <td class="name"><code>isdesc</code></td>
|
2133 |
|
2134 |
|
2135 | <td class="type">
|
2136 |
|
2137 |
|
2138 | <span class="param-type">bool</span>
|
2139 |
|
2140 |
|
2141 |
|
2142 | </td>
|
2143 |
|
2144 |
|
2145 | <td class="attributes">
|
2146 |
|
2147 | <optional><br>
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 | </td>
|
2154 |
|
2155 |
|
2156 |
|
2157 |
|
2158 | <td class="description last"><p>(Optional) If true, the property will be sorted in descending order</p></td>
|
2159 | </tr>
|
2160 |
|
2161 |
|
2162 | </tbody>
|
2163 | </table>
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 | <dl class="details">
|
2171 |
|
2172 |
|
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 | <dt class="tag-source">Source:</dt>
|
2198 | <dd class="tag-source"><ul class="dummy"><li>
|
2199 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2528">line 2528</a>
|
2200 | </li></ul></dd>
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 | </dl>
|
2209 |
|
2210 |
|
2211 |
|
2212 |
|
2213 |
|
2214 |
|
2215 |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 | <h5>Returns:</h5>
|
2223 |
|
2224 |
|
2225 | <div class="param-desc">
|
2226 | <p>Reference to this resultset, sorted, for future chain operations.</p>
|
2227 | </div>
|
2228 |
|
2229 |
|
2230 |
|
2231 | <dl>
|
2232 | <dt>
|
2233 | Type
|
2234 | </dt>
|
2235 | <dd>
|
2236 |
|
2237 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
2238 |
|
2239 |
|
2240 | </dd>
|
2241 | </dl>
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 | <h4 class="name" id="sort"><span class="type-signature"></span>sort<span class="signature">(comparefun)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 | <div class="description">
|
2259 | <p>User supplied compare function is provided two documents to compare. (chainable)</p>
|
2260 | </div>
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 | <h5>Parameters:</h5>
|
2271 |
|
2272 |
|
2273 | <table class="params">
|
2274 | <thead>
|
2275 | <tr>
|
2276 |
|
2277 | <th>Name</th>
|
2278 |
|
2279 |
|
2280 | <th>Type</th>
|
2281 |
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 | <th class="last">Description</th>
|
2287 | </tr>
|
2288 | </thead>
|
2289 |
|
2290 | <tbody>
|
2291 |
|
2292 |
|
2293 | <tr>
|
2294 |
|
2295 | <td class="name"><code>comparefun</code></td>
|
2296 |
|
2297 |
|
2298 | <td class="type">
|
2299 |
|
2300 |
|
2301 | <span class="param-type">function</span>
|
2302 |
|
2303 |
|
2304 |
|
2305 | </td>
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 | <td class="description last"><p>A javascript compare function used for sorting.</p></td>
|
2312 | </tr>
|
2313 |
|
2314 |
|
2315 | </tbody>
|
2316 | </table>
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 | <dl class="details">
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 | <dt class="tag-source">Source:</dt>
|
2351 | <dd class="tag-source"><ul class="dummy"><li>
|
2352 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2501">line 2501</a>
|
2353 | </li></ul></dd>
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 | </dl>
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 | <h5>Returns:</h5>
|
2376 |
|
2377 |
|
2378 | <div class="param-desc">
|
2379 | <p>Reference to this resultset, sorted, for future chain operations.</p>
|
2380 | </div>
|
2381 |
|
2382 |
|
2383 |
|
2384 | <dl>
|
2385 | <dt>
|
2386 | Type
|
2387 | </dt>
|
2388 | <dd>
|
2389 |
|
2390 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
2391 |
|
2392 |
|
2393 | </dd>
|
2394 | </dl>
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 | <h5>Example</h5>
|
2400 |
|
2401 | <pre class="prettyprint"><code>rslt.sort(function(obj1, obj2) {
if (obj1.name === obj2.name) return 0;
if (obj1.name > obj2.name) return 1;
if (obj1.name < obj2.name) return -1;
});</code></pre>
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 | <h4 class="name" id="transform"><span class="type-signature"></span>transform<span class="signature">(transform, parameters<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 | <div class="description">
|
2417 | <p>transform() - executes a named collection transform or raw array of transform steps against the resultset.</p>
|
2418 | </div>
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 | <h5>Parameters:</h5>
|
2429 |
|
2430 |
|
2431 | <table class="params">
|
2432 | <thead>
|
2433 | <tr>
|
2434 |
|
2435 | <th>Name</th>
|
2436 |
|
2437 |
|
2438 | <th>Type</th>
|
2439 |
|
2440 |
|
2441 | <th>Attributes</th>
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 | <th class="last">Description</th>
|
2447 | </tr>
|
2448 | </thead>
|
2449 |
|
2450 | <tbody>
|
2451 |
|
2452 |
|
2453 | <tr>
|
2454 |
|
2455 | <td class="name"><code>transform</code></td>
|
2456 |
|
2457 |
|
2458 | <td class="type">
|
2459 |
|
2460 |
|
2461 | <span class="param-type">string</span>
|
2462 | |
|
2463 |
|
2464 | <span class="param-type">array</span>
|
2465 |
|
2466 |
|
2467 |
|
2468 | </td>
|
2469 |
|
2470 |
|
2471 | <td class="attributes">
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 | </td>
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 | <td class="description last"><p>name of collection transform or raw transform array</p></td>
|
2483 | </tr>
|
2484 |
|
2485 |
|
2486 |
|
2487 | <tr>
|
2488 |
|
2489 | <td class="name"><code>parameters</code></td>
|
2490 |
|
2491 |
|
2492 | <td class="type">
|
2493 |
|
2494 |
|
2495 | <span class="param-type">object</span>
|
2496 |
|
2497 |
|
2498 |
|
2499 | </td>
|
2500 |
|
2501 |
|
2502 | <td class="attributes">
|
2503 |
|
2504 | <optional><br>
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 | </td>
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 | <td class="description last"><p>(Optional) object property hash of parameters, if the transform requires them.</p></td>
|
2516 | </tr>
|
2517 |
|
2518 |
|
2519 | </tbody>
|
2520 | </table>
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 | <dl class="details">
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 | <dt class="tag-source">Source:</dt>
|
2555 | <dd class="tag-source"><ul class="dummy"><li>
|
2556 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2417">line 2417</a>
|
2557 | </li></ul></dd>
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 | </dl>
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 | <h5>Returns:</h5>
|
2580 |
|
2581 |
|
2582 | <div class="param-desc">
|
2583 | <p>either (this) resultset or a clone of of this resultset (depending on steps)</p>
|
2584 | </div>
|
2585 |
|
2586 |
|
2587 |
|
2588 | <dl>
|
2589 | <dt>
|
2590 | Type
|
2591 | </dt>
|
2592 | <dd>
|
2593 |
|
2594 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
2595 |
|
2596 |
|
2597 | </dd>
|
2598 | </dl>
|
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 | <h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(updateFunction)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 | <div class="description">
|
2616 | <p>Used to run an update operation on all documents currently in the resultset.</p>
|
2617 | </div>
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 | <h5>Parameters:</h5>
|
2628 |
|
2629 |
|
2630 | <table class="params">
|
2631 | <thead>
|
2632 | <tr>
|
2633 |
|
2634 | <th>Name</th>
|
2635 |
|
2636 |
|
2637 | <th>Type</th>
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 | <th class="last">Description</th>
|
2644 | </tr>
|
2645 | </thead>
|
2646 |
|
2647 | <tbody>
|
2648 |
|
2649 |
|
2650 | <tr>
|
2651 |
|
2652 | <td class="name"><code>updateFunction</code></td>
|
2653 |
|
2654 |
|
2655 | <td class="type">
|
2656 |
|
2657 |
|
2658 | <span class="param-type">function</span>
|
2659 |
|
2660 |
|
2661 |
|
2662 | </td>
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 | <td class="description last"><p>User supplied updateFunction(obj) will be executed for each document object.</p></td>
|
2669 | </tr>
|
2670 |
|
2671 |
|
2672 | </tbody>
|
2673 | </table>
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 | <dl class="details">
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 |
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 | <dt class="tag-source">Source:</dt>
|
2708 | <dd class="tag-source"><ul class="dummy"><li>
|
2709 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line3099">line 3099</a>
|
2710 | </li></ul></dd>
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 | </dl>
|
2719 |
|
2720 |
|
2721 |
|
2722 |
|
2723 |
|
2724 |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 |
|
2731 |
|
2732 | <h5>Returns:</h5>
|
2733 |
|
2734 |
|
2735 | <div class="param-desc">
|
2736 | <p>this resultset for further chain ops.</p>
|
2737 | </div>
|
2738 |
|
2739 |
|
2740 |
|
2741 | <dl>
|
2742 | <dt>
|
2743 | Type
|
2744 | </dt>
|
2745 | <dd>
|
2746 |
|
2747 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
2748 |
|
2749 |
|
2750 | </dd>
|
2751 | </dl>
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 | <h4 class="name" id="where"><span class="type-signature"></span>where<span class="signature">(fun)</span><span class="type-signature"> → {<a href="Resultset.html">Resultset</a>}</span></h4>
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 | <div class="description">
|
2769 | <p>where() - Used for filtering via a javascript filter function.</p>
|
2770 | </div>
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 | <h5>Parameters:</h5>
|
2781 |
|
2782 |
|
2783 | <table class="params">
|
2784 | <thead>
|
2785 | <tr>
|
2786 |
|
2787 | <th>Name</th>
|
2788 |
|
2789 |
|
2790 | <th>Type</th>
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 |
|
2796 | <th class="last">Description</th>
|
2797 | </tr>
|
2798 | </thead>
|
2799 |
|
2800 | <tbody>
|
2801 |
|
2802 |
|
2803 | <tr>
|
2804 |
|
2805 | <td class="name"><code>fun</code></td>
|
2806 |
|
2807 |
|
2808 | <td class="type">
|
2809 |
|
2810 |
|
2811 | <span class="param-type">function</span>
|
2812 |
|
2813 |
|
2814 |
|
2815 | </td>
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 | <td class="description last"><p>A javascript function used for filtering current results by.</p></td>
|
2822 | </tr>
|
2823 |
|
2824 |
|
2825 | </tbody>
|
2826 | </table>
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 | <dl class="details">
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 | <dt class="tag-source">Source:</dt>
|
2861 | <dd class="tag-source"><ul class="dummy"><li>
|
2862 | <a href="lokijs.js.html">lokijs.js</a>, <a href="lokijs.js.html#line2959">line 2959</a>
|
2863 | </li></ul></dd>
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 | </dl>
|
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 | <h5>Returns:</h5>
|
2886 |
|
2887 |
|
2888 | <div class="param-desc">
|
2889 | <p>this resultset for further chain ops.</p>
|
2890 | </div>
|
2891 |
|
2892 |
|
2893 |
|
2894 | <dl>
|
2895 | <dt>
|
2896 | Type
|
2897 | </dt>
|
2898 | <dd>
|
2899 |
|
2900 | <span class="param-type"><a href="Resultset.html">Resultset</a></span>
|
2901 |
|
2902 |
|
2903 | </dd>
|
2904 | </dl>
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 | </article>
|
2917 |
|
2918 | </section>
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 | </div>
|
2924 |
|
2925 | <nav>
|
2926 | <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>
|
2927 | </nav>
|
2928 |
|
2929 | <br class="clear">
|
2930 |
|
2931 | <footer>
|
2932 | 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)
|
2933 | </footer>
|
2934 |
|
2935 | <script> prettyPrint(); </script>
|
2936 | <script src="scripts/linenumber.js"> </script>
|
2937 | </body>
|
2938 | </html> |
\ | No newline at end of file |