Comments (34)
localstorage isn't worthwhile, but indexeddb is. see https://github.com/rvagg/node-levelup, https://github.com/rvagg/node-leveldown and https://github.com/maxogden/level.js
from nedb.
Clearly localStorage is not ideal, considering its limitations, but at least it is supported by more browsers than IndexedDB. What I could do is to use IndexedDB when it is available and fall back to localStorage when it's not.
from nedb.
I think it would be worthwhile to create a browser version. Local client side storage is nice, but sometimes it's very useful to have a better in memory data structure for use as a data cache, etc (especially if you might exceed the HTML 5 storage limits, and can't rely on indexeddb support).
from nedb.
I just looked at your benchmarks against TaffyDB. Wow. NeDB would be an awesome alternative to TaffyDB. I know for some of the uses I was looking for, the find function alone would make NeDB the winner. If it was available in the browser.
from nedb.
The browser side world would benefit from having a faster datastore. With the advent of faster JS interpreters, more and more data processing happens on the client. In terms of persistence, I am with the others on focusing on localstorage. It may also be interesting to look at web workers to perform tasks such as async-durability (write data to localstorage in the background, rather than sync with the inserts).
from nedb.
Thanks for the comments, that confirms the need to port NeDB to browsers so I'll do it. The web workers idea is interesting, I'll do the porting first and then see how to do background persistence. I am experimenting on a similar idea for the current NeDB (I call it pipelining), but this is still experimental (queued saves can actually slow current operations).
from nedb.
I would highly recommend looking at the links I provided earlier. Local storage is not worth supporting, whereas indexeddb and websql are
Sent from my iPhone
On Jun 20, 2013, at 2:13 PM, Louis Chatriot [email protected] wrote:
Thanks for the comments, that confirms the need to port NeDB to browsers so I'll do it. The web workers idea is interesting, I'll do the porting first and then see how to do background persistence. I am experimenting on a similar idea for the current NeDB (I call it pipelining), but this is still experimental (queued saves can actually slow current operations).
—
Reply to this email directly or view it on GitHub.
from nedb.
@maxogden Yes as I said I'll probably use local storage only as fallback. But even as just an in-memory store, I think NeDB will be useful, when I see the number of people who use the much slower TaffyDB.
from nedb.
I was looking for a good way to store data locally in a (phonegap) type mobile app and then have it sync with MongoDB. There may be other solutions but if this was a way to do that it would be awesome too.
The other angle where I'd like to see this in the client is to make easier fakes for web browser based unit tests
from nedb.
@utunga I made this utility that you can use to transfer all your data from a NeDB database to a MongoDB one (for people who used NeDB for rapid prototyping and outgrew it).
For now you need to give it a NeDB datafile but I will adapt it when I port NeDB to the browser.
from nedb.
I would definitely say this feature would be very useful.
from nedb.
@louischatriot I'd very much like to have this library available for IE 9+, which would require LocalStorage support.
@maxogden PouchDB only uses IndexedDB, perhaps that's more for you. There is value for some of us in supporting older browsers. WebSQL is dead.
from nedb.
I think it would be cool to make the browser storage engine as plugin or adding events emitters to the database so you could have it sync to Dropbox or Google Drive as well.
Example
var tasks = new NeDB({localStorage: 'tasks'});
tasks.on('insert', function(task) {
dropbox.writeFile('tasks.db', tasks.localStorage, function(err) {
if (!err) { console.log('synced');
});
});
This would require creation by specifying the id and access to the localStorage value. The reference for the dropbox sdk is here https://tech.dropbox.com/2012/08/some-love-for-javascript-applications-2/
from nedb.
@louischatriot I am excited to see Nedb come along, especially in seeing it's similarities to MongoDB and would love to see it working in the Browser.
I agree with @maxogden etc, that you should avoid localstorage, as it is too limiting for any serious use. Either WebSQL or IndexedDB are available for all browsers and there are front end wrappers that convert the IndexedDB API into WebSQL as required. This will enable you to just write a DB plugin for IndexedDB that will then run on all Browsers. See: http://nparashuram.com/IndexedDBShim/
from nedb.
I am mystified at why you guys are trying to persuade Louis to not implement a feature that he seems to want to do, and that I absolutely require, when doing so has zero effect on anyone who prefers IndexedDB as that will also be supported.
from nedb.
@naturalethic If your localstorage meets your requirements then that's fine, but I would have thought it less work for Louis to support a single API, that being IndexedDB, which with the shim I mentioned will work on all browsers. In that case why even bother supporting the limited capabilities of localStorage. To quote: http://stackoverflow.com/questions/2989284/what-is-the-max-size-of-localstorage-values
Web storage can be viewed simplistically as an improvement on cookies,
providing much greater storage capacity (2.5 MB per origin in Google Chrome;
5 MB per origin in Mozilla Firefox, and Opera; 10 MB per storage area in Internet Explorer)
and better programmatic interfaces.
And you may want to see the results on this page: http://arty.name/localstorage.html
Further localStorage only supports strings and has no index capabilities. And the user can delete the contents of localStorage, which could be a disaster waiting to happen.
from nedb.
God god yes! I'd love to see this.
from nedb.
Does nedb having a Browser based Console to see/edit/config the data .
Sometimes we need to watch the data in Memory when developing or testing.
The best embed database in JAVA--h2, having a Browser based Console application, which is very convenient.
from nedb.
There is no such thing yet. What you could do however is use Mongo Edit (another project of mine, a web based Mongo GUI) and modify it to make it work with nedb. That should not be too much work since both APIs are very close. I unfortunately don't have enough time to do it.
Here is the link : https://github.com/louischatriot/mongo-edit
from nedb.
Will the in browser port be available as a different project, or will the existing project be modified to work in both environments?
from nedb.
My goal is to use the same project since most of the code will be common.
from nedb.
I finally found the time to do it, the browser version is ready! Check the readme out: https://github.com/louischatriot/nedb#browser-version
It's still young, for now it doesn't support persistence (working on it) and I haven't yet tested it on all browsers (working on it) but at least you can test this young version :)
from nedb.
Dependencies 'underscore' and 'binary-search-tree' are missing from the dependency check.
from nedb.
I don't understand, where are they missing from the dependency check?
Le 14 juil. 2013 à 20:52, Joshua Kifer [email protected] a écrit :
Dependencies 'underscore' and 'binary-search-tree' are missing from the dependency check.
—
Reply to this email directly or view it on GitHub.
from nedb.
I had to install them manually with npm is all. The build didn't install
them. I didn't examine the build.js code.
On Sun, Jul 14, 2013 at 1:39 PM, Louis Chatriot [email protected]:
I don't understand, where are they missing from the dependency check?
Le 14 juil. 2013 à 20:52, Joshua Kifer [email protected] a écrit
:Dependencies 'underscore' and 'binary-search-tree' are missing from the
dependency check.—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-20943354
.
from nedb.
The browser version is standalone, you don't need to install anything with npm, just include nedb.js in your html files. I updated the readme with a code example, tell me if that's clear
Le 14 juil. 2013 à 23:06, Joshua Kifer [email protected] a écrit :
I had to install them manually with npm is all. The build didn't install
them. I didn't examine the build.js code.On Sun, Jul 14, 2013 at 1:39 PM, Louis Chatriot [email protected]:
I don't understand, where are they missing from the dependency check?
Le 14 juil. 2013 à 20:52, Joshua Kifer [email protected] a écrit
:Dependencies 'underscore' and 'binary-search-tree' are missing from the
dependency check.—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/23#issuecomment-20943354
.—
Reply to this email directly or view it on GitHub.
from nedb.
Yes that's clear. I had just chosen to build it myself, this console output should make clear what I meant:
joshua@zeta nedb § node browser-version/build.js
Installing build dependencies
Removing contents of the src directory
Copying source files
Copying browser specific files to replace their server-specific counterparts
Browserifying the code
Error during build
[Error: module "underscore" not found from "/Users/joshua/Workspace/nedb/browser-version/src/lib/datastore.js"]
joshua@zeta nedb § ls node_modules/
async browserify fs-extra uglify-js
joshua@zeta nedb § npm install underscore
npm http GET https://registry.npmjs.org/underscore
npm http 200 https://registry.npmjs.org/underscore
npm WARN package.json [email protected] 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json [email protected] No repository field.
[email protected] node_modules/underscore
joshua@zeta nedb § node browser-version/build.js
Installing build dependencies
Removing contents of the src directory
Copying source files
Copying browser specific files to replace their server-specific counterparts
Browserifying the code
Error during build
[Error: module "binary-search-tree" not found from "/Users/joshua/Workspace/nedb/browser-version/src/lib/indexes.js"]
joshua@zeta nedb § npm install binary-search-tree
npm http GET https://registry.npmjs.org/binary-search-tree/0.2.3
npm http 200 https://registry.npmjs.org/binary-search-tree/0.2.3
npm http GET https://registry.npmjs.org/binary-search-tree/-/binary-search-tree-0.2.3.tgz
npm http 200 https://registry.npmjs.org/binary-search-tree/-/binary-search-tree-0.2.3.tgz
npm WARN package.json [email protected] 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json [email protected] No repository field.
[email protected] node_modules/binary-search-tree
joshua@zeta nedb § node browser-version/build.js
Installing build dependencies
Removing contents of the src directory
Copying source files
Copying browser specific files to replace their server-specific counterparts
Browserifying the code
Creating the minified version
Build finished with success
from nedb.
The issue was that the source dependencies such as underscore and binary-search-tree are not checked in to the Git repo so you needed to reinstall them. This is now automatic.
from nedb.
Is there any way to integrate NeDB with Phonegab, so we can use it for mobile Devices(android, ios etc).
from nedb.
That would definitely be valuable and interesting, yes. I have no experience with Phonegap, could you open a new issue with the requirements ?
from nedb.
As of v1.4, NeDB automatically selects the best method to persist data on the browser (IndexDB then WebSQL then localStorage), so the limit is removed. WARNING: it's not back compatible with v1.3, but that should not be a major issue as user apps can resync entirely.
from nedb.
NeDB for browsers and mobile platforms like Andoid, ios through Phonegap to persist data locally will be utmost useful utility database. I am sure it will be the most popular database after Mongodb. Though, I tried including version 1.8, as mentioned in package.json, of nedb.js and/or nedb.min.js in html file using script tag from folder nedb/ browsers-version/out folder, but it gives error. Further guidance for how to include nedb.js in html file for saving data on local disk will be very much appreciated...
<title>Document</title> <script src="js/material.js"></script> <style> body { margin-left: 15px; } input { width: 400px; margin-bottom: 5px; } label { width: 90px; /* text-align: right; */ float: left; } form { margin-left: 5px; } </style>Personal Details:
<form name="testForm"
action="#"
method="POST">
<!-- onSubmit="var hasSaved = saveContact(); return hasSaved;"> -->
<label for="fname">First Name:</label>
<input type="text" placeholder="First name" id="fname"><br>
<label for="mname">Middle Name:</label>
<input type="text" placeholder="Middle name" id="mname"><br>
<label for="lname">Last Name:</label>
<input type="text" placeholder="Last name" id="lname"><br>
<label for="building">Building:</label>
<input type="text" placeholder="Building" id="building"><br>
<label for="street">Street:</label>
<input type="text" placeholder="Street" id="street"><br>
<label for="locality">Locality:</label>
<input type="text" placeholder="Locality" id="locality"><br>
<label for="landmark">Landmark:</label>
<input type="text" placeholder="Landmark" id="landmark"><br>
<label for="city">City:</label>
<input type="text" placeholder="City" id="city"><br>
<label for="zip">Zip/Pin Code:</label>
<input type="text" placeholder="ZIP/PIN Code" id="zip"><br>
<label for="state">State:</label>
<input type="text" placeholder="State" id="state"><br>
<label for="country">Country:</label>
<input type="text" placeholder="Country" id="country"><br>
</form>
</div>
<!-- buttons examples -->
<div id="buttons">
<!-- Accent-colored raised button with ripple -->
<button class="mdl-button
mdl-js-button
mdl-button--raised
mdl-js-ripple-effect
mdl-button--accent"
type="submit"
onclick="saveContact();">
Save Contact
</button>
<hr>
<h4>Result:</h4>
<p id="result"></p>
<!-- Colored FAB button -->
<!-- <button class="mdl-button mdl-js-button mdl-button--fab mdl-button--colored">
<i class="material-icons">add</i>
</button> -->
</div>
from nedb.
@Dasanudas there is actually a db inspired by nedb but built on in many ways and updated to Es6 and has the capability to do all the things you would like. you could write an html parser to overhead this db as well. It's maintained by myself and another and has others who are watching and waiting for new ideas to build on. https://github.com/tedb-org/teDB
from nedb.
from nedb.
Related Issues (20)
- NPM found 2 high severity vulnerabilities in NeDB, require manual review HOT 10
- NeDB datastore Model needs to be provided
- update the version of underscore dependence! HOT 1
- How to search multiple feilds' "$and"? HOT 4
- Add link to "official" fork HOT 8
- "this library is no longer maintained" HOT 7
- Insert doesn't take place immediately HOT 2
- How to catch abort if the capacity of storage is full??
- $setOnInsert is not work??????
- high vulnerabilities for this package HOT 2
- Error: Cannot create a string longer than 0x1fffffe8 characters HOT 1
- Please update dependency underscore HOT 4
- files
- Data Loss HOT 1
- Request to move repo under NW Userland
- PLEASE !!! Fork this project and create a new one HOT 1
- How to use expireAfterSeconds?
- i have a probleme to photo to nedb db HOT 1
- Regarding the issue of writing permissions
- Update creates a duplicate with exact same _id HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nedb.