Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is "path" variables in FirebaseDatabase.getReference().childByAutoId() method #4

Open
amo222lpatil opened this issue Aug 14, 2018 · 0 comments

Comments

@amo222lpatil
Copy link

amo222lpatil commented Aug 14, 2018

i am using your below code in appcelerator

var FirebaseCore = require('firebase.core');
FirebaseCore.configure();
var FirebaseDatabase = require('firebase.database');

// Inserting values in firebase database
var fdRef = FirebaseDatabase.getReference().childByAutoId({
	path: 'user'
});

fdRef.setValue({
	username: 'username',
	email: '[email protected]',
	password: 'ABCXYZ',
	timestamp: FirebaseDatabase.getFirebaseServerTimestamp()
}, function(e) {
	Ti.API.info('Value written, snapshot: ' + JSON.stringify(e, null, 4));
});

// Fetching values from Firebase database

var userRef = FirebaseDatabase.getReference({
	path: 'user',
	observableEvents: [FirebaseDatabase.DATA_EVENT_TYPE_CHILD_ADDED, FirebaseDatabase.DATA_EVENT_TYPE_VALUE]
});

userRef.addEventListener('value', function(e) {
	Ti.API.info('DATA_EVENT_TYPE_VALUE, snapshot: ' + JSON.stringify(e, null, 4));
});

userRef.addEventListener('add', function(e) {
	Ti.API.info('DATA_EVENT_TYPE_CHILD_ADDED, snapshot: ' + JSON.stringify(e, null, 4));
});

But i didnt get What value should i assign to "path" variables in FirebaseDatabase.getReference().childByAutoId() method.
Does it is collection name in firebase project ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant