UNPKG

3.89 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Tutorial: TEST</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">Tutorial: TEST</h1>
21
22 <section>
23
24<header>
25
26
27 <h2>TEST</h2>
28</header>
29
30<article>
31 <h1>LokiJS</h1><p><a href="http://lokijs.org">LokiJS.org web site</a> |
32<a href="https://github.com/techfort/LokiJS">LokiJS GitHub page</a> |
33<a href="https://rawgit.com/techfort/LokiJS/master/examples/sandbox/LokiSandbox.htm">Sandbox / Playground</a></p>
34<h2>Documentation Overview</h2><p>This is an early effort using jsdoc to provide a more accurate and up-to-date version of LokiJS documentation. Since modifications arise from various contributors, this should allow distributed effort toward
35maintaining this documentation. For the time being, you can use it along with LokiJS.org documentation and the
36GitHub wiki documentation. Ideally this will emcompass the best of both reference as well as more complete examples
37and descriptions.</p>
38<h2>Getting Started</h2><p>Creating a database :</p>
39<pre class="prettyprint source lang-javascript"><code>var db = new loki('example.db');</code></pre><p>Add a collection :</p>
40<pre class="prettyprint source lang-javascript"><code>var users = db.addCollection('users');</code></pre><p>Insert documents :</p>
41<pre class="prettyprint source lang-javascript"><code>users.insert({
42 name: 'Odin',
43 age: 50,
44 address: 'Asgard'
45});
46
47// alternatively, insert array of documents
48users.insert([{ name: 'Thor', age: 35}, { name: 'Loki', age: 30}]);</code></pre><p>Simple find query :</p>
49<pre class="prettyprint source lang-javascript"><code>var results = users.find({ age: {'$gte': 35} });
50
51var odin = users.findOne({ name:'Odin' });</code></pre><p>Simple where query :</p>
52<pre class="prettyprint source lang-javascript"><code>var results = users.where(function(obj) {
53 return (obj.age >= 35);
54});</code></pre><p>Simple Chaining :</p>
55<pre class="prettyprint source lang-javascript"><code>var results = users.chain().find({ age: {'$gte': 35} }).simplesort('name').data();</code></pre><p>Simple named transform :</p>
56<pre class="prettyprint source lang-javascript"><code>users.addTransform('progeny', [
57 {
58 type: 'find',
59 value: {
60 'age': {'$lte': 40}
61 }
62 }
63]);
64
65var results = users.chain('progeny').data();</code></pre><p>Simple Dynamic View :</p>
66<pre class="prettyprint source lang-javascript"><code>var pview = users.addDynamicView('progeny');
67
68pview.applyFind({
69 'age': {'$lte': 40}
70});
71
72pview.applySimpleSort('name');
73
74var results = pview.data();</code></pre>
75</article>
76
77</section>
78
79</div>
80
81<nav>
82 <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="LokiIndexedAdapter.html">LokiIndexedAdapter</a></li><li><a href="LokiLocalStorageAdapter.html">LokiLocalStorageAdapter</a></li><li><a href="Resultset.html">Resultset</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-TEST.html">TEST</a></li></ul>
83</nav>
84
85<br class="clear">
86
87<footer>
88 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Apr 04 2016 19:58:36 GMT-0400 (EDT)
89</footer>
90
91<script> prettyPrint(); </script>
92<script src="scripts/linenumber.js"> </script>
93</body>
94</html>
\No newline at end of file