2016-07-29 3 views
0

다음 코드는 예상대로 작동합니다. 나는 각 푸시에 대한 중포 기지, 하나에 여러 여행을하고있는 중이 야,Firebase에서 데이터 목록 추가

// Save default Account Types 
var refTypes = this.housesRef.child(key + "/memberaccounttypes/"); 
refTypes.push({ name: 'Checking', icon: '0' }); 
refTypes.push({ name: 'Savings', icon: '0' }); 
refTypes.push({ name: 'Credit Card', icon: '0' }); 
refTypes.push({ name: 'Debit Card', icon: '0' }); 
refTypes.push({ name: 'Investment', icon: '0' }); 
refTypes.push({ name: 'Brokerage', icon: '0' }); 
  1. 이 방법 :하지만이 개 질문이?
  2. 다음 데이터를 한 번에 효율적으로 저장하는 가장 효율적인 방법이 있습니까?

난 정말 중포 기지에 왕복 발생합니다 이런 식으로 밀어 중포 기지 SDK 3

답변

0

에게 각각 전화를 사용하고 있습니다. 브라우저 디버그 도구의 네트워크 탭에있는 "웹 소켓"창을 확인하여 쉽게 확인할 수 있습니다. 단일 업데이트로 실행하려는 경우

, 당신은 함께 다중 위치 업데이트로 결합 할 수 있습니다 :이 거의 the Firebase client pipelines requests 때문에, 언제든지/대역폭을 절약하지 않습니다

var refTypes = this.housesRef.child(key + "/memberaccounttypes/"); 
var updates = {}; 
updates[refTypes.push().key] = { name: 'Checking', icon: '0' }; 
updates[refTypes.push().key] = { name: 'Savings', icon: '0' }; 
updates[refTypes.push().key] = { name: 'Credit Card', icon: '0' }; 
updates[refTypes.push().key] = { name: 'Debit Card', icon: '0' }; 
updates[refTypes.push().key] = { name: 'Investment', icon: '0' }; 
updates[refTypes.push().key] = { name: 'Brokerage', icon: '0' }; 
refTypes.update(updates); 

하는 것으로.

+0

언제나처럼 당신이 최고입니다. 프랭크 고마워! –

관련 문제