Skip to content

backbone-db "formal" interface #1

@Nomon

Description

@Nomon

Here is what I propose as the minimal formal interface for backbone-db implementation and the minimum supported options/operations. As the jsonquery format used in several of the adapter once the interface is fully implemented and "formalised" many things like after_id and before_id can be implemented as shorthands for where:{something:"funny", id:{$gt:after_id}}, sort:{id:1} etc.

_.extend(DB.prototype, Backbone.Events, {
  find: function(model, options, cb) {},
  findAll: function(model, options, cb) {},
  read: function(model, options, cb) {},
  update: function(model, options, cb) {},
  destroy: function(model, options, cb) {}
});

// Available options
// where: jsonselect mongodb like query syntax object
// sort: sort docs by attribute: -1 / 1
// limit: limit fetch to x results
// offset: skip x results
// after_id: where: {id:{$gt:after_id}}, sort: {id:1}
// before_id: where: {id:{$lt:before_id}}, sort: {id:-1}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions