Advertisement
Guest User

Untitled

a guest
May 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import * as firebase from "firebase/app";
  2. import 'firebase/firestore';
  3. import config from './config';
  4.  
  5. firebase.initializeApp(config);
  6.  
  7. const data = {
  8. string: 'foo',
  9. integer: 23,
  10. boolean: false,
  11. timestamp: firebase.firestore.Timestamp.fromDate(new Date())
  12. };
  13.  
  14. const doc = firebase.firestore().doc('path/to/doc');
  15.  
  16. doc.set(data).then(() => console.log('success')).catch(e => console.error(e));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement