Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var getData = function (id) {
- return new Promise(function (resolve, reject) {
- db.collection('users').doc(id).get()
- .then(function (doc) {
- if (doc.exists) {
- resolve(doc.data());
- }
- reject('Document not found');
- })
- .catch(function (exception) {
- reject(exception);
- })
- });
- }
- var id = 6;
- getData(id).then(function (data) {
- console.log('Datos:', data);
- // Proceso a realizar
- }).catch(function (exception) {
- console.error('Exeption:', exception);
- });
Add Comment
Please, Sign In to add comment