UNPKG

4.39 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Home</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">Home</h1>
21
22
23
24
25
26
27
28
29 <h3> </h3>
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 <section>
46 <article><h1>LokiJS</h1><p><a href="http://lokijs.org">LokiJS.org web site</a> |
47<a href="https://github.com/techfort/LokiJS">LokiJS GitHub page</a> |
48<a href="https://rawgit.com/techfort/LokiJS/master/examples/sandbox/LokiSandbox.htm">Sandbox / Playground</a></p>
49<h2>Documentation Overview</h2><p>This is an early effort to provide a more accurate and up-to-date version of LokiJS documentation by using jsdoc. Since modifications arise from various contributors, this should allow distributed effort toward
50maintaining this documentation. </p>
51<h2>Getting Started</h2><p>Creating a database :</p>
52<pre class="prettyprint source lang-javascript"><code>var db = new loki('example.db');</code></pre><p>Add a collection :</p>
53<pre class="prettyprint source lang-javascript"><code>var users = db.addCollection('users');</code></pre><p>Insert documents :</p>
54<pre class="prettyprint source lang-javascript"><code>users.insert({
55 name: 'Odin',
56 age: 50,
57 address: 'Asgard'
58});
59
60// alternatively, insert array of documents
61users.insert([{ name: 'Thor', age: 35}, { name: 'Loki', age: 30}]);</code></pre><p>Simple find query :</p>
62<pre class="prettyprint source lang-javascript"><code>var results = users.find({ age: {'$gte': 35} });
63
64var odin = users.findOne({ name:'Odin' });</code></pre><p>Simple where query :</p>
65<pre class="prettyprint source lang-javascript"><code>var results = users.where(function(obj) {
66 return (obj.age >= 35);
67});</code></pre><p>Simple Chaining :</p>
68<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>
69<pre class="prettyprint source lang-javascript"><code>users.addTransform('progeny', [
70 {
71 type: 'find',
72 value: {
73 'age': {'$lte': 40}
74 }
75 }
76]);
77
78var results = users.chain('progeny').data();</code></pre><p>Simple Dynamic View :</p>
79<pre class="prettyprint source lang-javascript"><code>var pview = users.addDynamicView('progeny');
80
81pview.applyFind({
82 'age': {'$lte': 40}
83});
84
85pview.applySimpleSort('name');
86
87var results = pview.data();</code></pre></article>
88 </section>
89
90
91
92
93
94
95</div>
96
97<nav>
98 <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>
99</nav>
100
101<br class="clear">
102
103<footer>
104 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)
105</footer>
106
107<script> prettyPrint(); </script>
108<script src="scripts/linenumber.js"> </script>
109</body>
110</html>
\No newline at end of file