Manually inserting data in Firebase

前端 未结 4 1733
梦毁少年i
梦毁少年i 2021-02-01 13:50

I am creating an app using Angular.js and Firebase and until I have the interface in working order, I am planning on manually inserting data. While it\'s easy enough to add key:

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-01 14:35

    An interface that would efficiently and quickly edit a hierarchy of data would naturally need to anticipate that hierarchy. So you're not going to find a pre-built tool to edit tiered data without tedious data entry.

    Generally, I keep a second browser window opened, logged in with admin privileges, and just manually input the objects using the browser's debugger (e.g. Firebug). I find this quite a bit faster than import/export of JSON (and writing JSON is so tedious!).

    Generally, I prefer update over set, as this means I can just enter the changes rather than having to write out the entire hierarchy:

    new Firebase(MY_URL).child(PATH).update({
       // replace the widgets
       widgets: {
          one: { color: 'red', shape: 'square' },
          two: { color: 'green', shape: 'triangle' }
       },
    
       // reset the count
       widgetCount: 0,
    
       // delete my status
       status: null
    });
    

    If neither the Forge tools nor inputting via debugger suits you, then you might find it worth the investment to write a quick and dirty, ugly and primitive, admin page where you can alter the data and save it.

    I have several of these, which I whipped up in around an hour each, to use for frequent admin routines on our sites. The trick is to build only what you need and not get caught up in how cool and awesome it could be. Spartan FTW.

提交回复
热议问题