Suggestions and New Feature Ideas

typicaljoe edited this page Oct 15, 2011 · 2 revisions
Clone this wiki locally


  1. New site design.
  2. A Getting Started Guide of some kind.
  3. A better way of testing builds - right now I have a page with a number of feature tests but it isn't very clean and it could be automated


  • .merge([records],[optional primarykey]]) - takes a an array of records and loops over the data set inserting new records and updating old records. By default it will try to use id for the merge but you can pass an optional array of fields to be a primary key (example: ["userid","projectid"]

  • .update(func) - support passing a function to the update method. If a function is passed the records should be cloned via mergeObj() and changes only applied to what is passed back out of the func. Ideally there would be support for passing out the modified record to be updated or an object that specifics the changes to this particular record. When making an update the onUpdate method will be called as normal. Additionally it would be nice to support something like return false for no update and return TAFFY.EXIT to stop the record loop. db().update(function (r) {r.hits++;return r;})

  • .get()/.stringify() field support - if you passed in true (.get(true)/.stringify(true)) you would get back a 'trimmed' version of the records with the ___id and ___s values removed. If you passed in an array of column names you would get back objects with only those values (.get(["first","last","zip"]). This would also apply to .first and .last

  • insert([records],true) append to start of DB - If true is the last arg value the insert will append to the start of the array instead of the end.

  • db().insert() - for inserting before/after record. Something like db({id:1}).insert(newrecord) to insert after and db({id:1}).insert(newrecord,true) to insert before the record. If more than one record is matched then it will insert before all records or after all records.

  • Deep nesting support for queries. So when you build an object to filter on it will traverse down the record object until it runs into the end of a filter object or a comparison operator (such as gt, lt, like, etc). Right now it will go down one level but it should be unlimited. Example of something that doesn't work right: db({pets:{id:{gt:2}}}) (assuming a record format of {pets:{[id:0]}})