Query about the structure of Firebase

1

Dear, I am developing an account plan and I am using a non-relational database (I hope I have not made a mistake), and I need to make it possible to create an account plan with firebase. In addition to Firebase I'm using Vuejs, but at the moment of creating the structure:

{
  "Activo": {
    "Sub cuenta de activo": {
      "nombre": ""
      },"Sub cuenta de activo 2": { ""},.....
    }

  },
  "Pasivo": {
    "Sub cuenta de pasivo": {
      "nombre": ""
      },"Sub cuenta de pasivo 2": { ""},.....
    }

  }
}

And so (Sub asset account 3..etc), keep creating infinitely sub accounts of assets or liabilities. For this I think I need to know how to create or add .chield () to the referral URL to perform the corresponding push () associated with the ID of the "table" or object. I was looking for thousands of ways but I always came to the same problem, having to manually add the reference url. To pass in clean, want to know how to create a method in Vuejs where you can add .chield () automatically without manually doing it manually. For example, applying the singleton development pattern.

    
asked by Nahuel Jakobson 13.11.2018 в 21:34
source

1 answer

0

If I understand correctly, the structure is a list of passive and active accounts. Where you put "sub passive account .." could be the key through a push of firebase. With having a reference to the database in "passive" and another in "Active" you should have no problem to add more accounts. Just have to do "FirebaseDatabase.getInstance (). GetReference ('Passive'). Push (). SetValue (new CuentaPasivi ());" and then to get the accounts you only create a listener in the passive reference and you travel in a for Each account or you use ChildEventListener Or you can order for some child node and get some particular If it is an account per user you could use the user's uid as the key of your account, if you can have several accounts with the Push you will create different keys for each I hope this is what you were looking for! regards.

    
answered by 14.11.2018 в 13:20