backbone.js - How to set up Firebase location as a Backbone Model ID? -


i use backfire - firebase integration backbone.js

examining backfire demo application see firebase location set "root" key , value id key.

json response firebase   {   "-it-myawefbi1qgd8pxb":      {      "title":dummy title",      "id": "-it-myawefbi1qgd8pxb"     }  } 

in model see firebase location set model id.

backbone model attributes   attributes: {   id: '-iswdv_2rwzu3who0giq'   title: 'dummy title' }, id : '-iswdv_2rwzu3who0giq' 

i wonder how data structure in firebase forge (backend) creates response described above?

by going todo page , typing in command:

new firebase('https://backbone.firebaseio.com').once('value', function(ss) { console.log(json.stringify(ss.val(), null, 2))}); 

i able see data structure looks this:

{   "-it-myawefbi1qgd8pxb": {     "id": "-it-myawefbi1qgd8pxb",     "title": "prepare lunch"   },   "-it-mch8_ba23vkwabuz": {     "id": "-it-mch8_ba23vkwabuz",     "title": "install linux"   } } 

so basically, because it's demo, anant has obeyed kiss , put todo items @ root level. in sophisticated application, you'd need have more nesting , depth, of course.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -