firestore数据库的使用情况-无需进行读取操作即可随机增加读取计数

时间:2019-04-20 07:02:32

标签: google-cloud-firestore

我正要在localhost中测试代码。

阅读:93
写:5
删除:4

我不知道为什么读数已经是93。因为我还没有为firestore编写任何.get代码。

我使用add({})方法添加了4个文档,并删除了全部四个文档。删除为4,这是准确值。

我试图合并分数数据,这也表明写入计数为5。

为什么读取计数为93?

尝试再次更新分数后,

阅读:97
写:6
删除:4

读取计数增加4。为什么?

function updateScore() {    
    db
    .collection('users')
    .doc(user_id)
     .set(
     { score: [{ score: score, data: date, percentage: percentage }] },
     { merge: true })
     .then(function() {
     console.log('updated..');
     });
}


<script>
            // Initialize Firebase
            var config = {
                apiKey: "key",
                authDomain: "domain.firebaseapp.com",
                databaseURL: "url",
                projectId: "id",
                storageBucket: "storage",
                messagingSenderId: "id"
            };
            firebase.initializeApp(config);
            var db = firebase.firestore();

        </script>

0 个答案:

没有答案
相关问题