SHARE
TWEET

Untitled

a guest May 19th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top