Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

firebase is there a way to rename a document

const firestore = firebase.firestore();
// get the data from 'name@xxx.com'
firestore.collection("users").doc("name@xxx.com").get().then(function (doc) {
    if (doc && doc.exists) {
        var data = doc.data();
        // saves the data to 'name'
        firestore.collection("users").doc("name").set(data).then({
            // deletes the old document
            firestore.collection("users").doc("name@xxx.com").delete();
        });
    }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: sessionStorage on DOMContentLoaded javascript 
Javascript :: variables are used to store data values. 
Javascript :: my env.local file not working in my react app usind mac 
Javascript :: logo ticker html javascript 
Javascript :: switch case in jsx 
Javascript :: rollup js global installation 
Javascript :: vue2-editor save image 
Javascript :: browser console noting displayed 
Javascript :: parsing error cannot find module 
Javascript :: asasa 
Javascript :: message is not working on emit in node.js 
Javascript :: which element occours when a DOM element recieve the coursor 
Javascript :: float vape pen instructions 
Javascript :: react developer cvs 
Javascript :: jabascript for each 
Javascript :: KIVIN 
Javascript :: validator.contains 
Javascript :: Angular generate by skipping test files 
Javascript :: .catch() in promise will aslo return a promise 
Javascript :: Wikibreak enforcer 
Javascript :: javascript test https 
Javascript :: how to plot a line only for current day pinescript 
Javascript :: add link in react table 
Javascript :: get last day of month js 
Javascript :: Convert form data to JavaScript object with jQuery 
Javascript :: odoo owl usestate 
Javascript :: react button on child Content Data initialize 
Javascript :: remove nth character from string javascript 
Javascript :: telerik jquery grid trigger editcell 
Javascript :: numberformat chakra 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =