typicaljoe / taffydb

TaffyDB - an open source JavaScript Database for your browser
http://taffydb.com
MIT License
2.21k stars 286 forks source link

documentation fix #160

Open stevenhaab opened 5 years ago

stevenhaab commented 5 years ago

On "Working with Data", the .sum() example is showing .last("balance"). It should say .sum('balance')

For .get() I wonder if it's examples got deleted. It's probably amazing, but I have no idea how to use it. Can I use it to select a subset of records in an ordered result?

For .start(), adding "The first record is 1, not 0".

I cannot figure out how to return the 2nd, or 3rd or 4th record in an ordered. I only want 1 result so I .limit(1) and if I want the 2nd record, I set .start(2) but I get 0 results. Adding documentation of how to do it correctly, would help me.

And by the way, this taffydb is wonderful.

stevenhaab commented 5 years ago

Another thing in the documentation that I find confusing: I want to remove some records from the query object, and all I can find is db().remove(). But it says it will remove from the database, not a resulting query object. Is there a command to .omit or .exclude from a query object? It seems to be, if it's going permanently delete records from a database, it should be db.remove() and not db().remove(). I'm afraid to test this. db().remove() is in the Query Object methods section. Is it in the wrong section, or is the documentation wrong?

stevenhaab commented 5 years ago

The db().filter() , the documentation mentions Functions. An example would be helpful. I'm wondering if it is like .each() and does it call the function for each record in the query object? Does return false; omit a record from the query object result?

Is there a command that will convert a Query object result, into a new database under a new name, which I would consider using if db().remove() can only remove records from a database.

stevenhaab commented 5 years ago

Adding a section to define words, would be helpful. "collection" is confusing. Sometimes it's data in localStorage, other times is a Query Object, and it can be the whole database.

db().order("col1 desc").filter( function() { // test true or false }); Seems to apply the filter function to the original data, before ".order", unfortunately. If I wanted the original data, I could put the function in db( function() {// test true or false }).order("col1 desc"); Is there a workaround?