有没有办法检查firejs的firestore中是否存在子集合?
目前我doc.exists用于文档,但我需要检查文档中是否存在子列,以便写入一些数据.
我一直在努力弄清楚如何使用 v-dialog 测试 Vue 组件,这在 Vue2 中运行得非常好。目前我正在使用Vue3、Vitest、Vuetify3。
这是一个非常简单的组件,它演示了一个问题
<template>
<div>
<v-btn @click.stop="dialog=true" class="open-dialog-btn">click me please</v-btn>
<v-dialog v-model="dialog" max-width="290" >
<div class="dialog-content">
<v-card>welcome to dialog</v-card>
</div>
</v-dialog>
</div>
</template>
<script setup>
import {ref} from "vue";
const dialog = ref(false);
</script>
Run Code Online (Sandbox Code Playgroud)
这是它的单元测试:
import '../setup';
import { mount } from '@vue/test-utils';
import { createVuetify } from "vuetify";
import HelloDialog from "@/components/HelloDialog.vue";
describe('HelloDialog', () => {
let wrapper;
let vuetify;
beforeEach(() => {
vuetify = createVuetify();
});
describe('dialog tests', () => …Run Code Online (Sandbox Code Playgroud) 我的意思是我知道那些是什么,但我对安全规则有点困惑,例如:
service cloud.firestore {
match /databases/{database}/documents {
// This is probably a mistake
match /spaceships { // <= what is this a collection or a document?
allow read;
// In spite of the above line, a user can't read any document within the
// spaceship collection.
}
}
}
Run Code Online (Sandbox Code Playgroud)
Firebase 文档说:
集合规则不适用于该集合中的文档。在集合级别而不是文档级别编写安全规则是不寻常的(并且可能是错误的)。
这意味着这match /spaceships {...是一个集合对吗?
但后来我们有这个:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**}{ // <= what is this a document or a collection?
allow read, write: if …Run Code Online (Sandbox Code Playgroud)