onSnaphot creates Collections
This commit is contained in:
parent
10f3b4fa50
commit
50268d05c5
@ -470,7 +470,7 @@ export class CollectionQuery extends Query {
|
|||||||
async snapshot(onChange: (change: (DocRes & { type: ChangeTypes })[]) => void) {
|
async snapshot(onChange: (change: (DocRes & { type: ChangeTypes })[]) => void) {
|
||||||
if (this.subscription)
|
if (this.subscription)
|
||||||
throw new Error("This query is already subscribed!");
|
throw new Error("This query is already subscribed!");
|
||||||
let { collection, document } = await this.resolve(this.path);
|
let { collection, document } = await this.resolve(this.path, true);
|
||||||
|
|
||||||
let data = await this.get();
|
let data = await this.get();
|
||||||
|
|
||||||
@ -516,6 +516,9 @@ export class CollectionQuery extends Query {
|
|||||||
|
|
||||||
|
|
||||||
public async collections() {
|
public async collections() {
|
||||||
|
if (!this.session.root)
|
||||||
|
throw new Error("No Permission!");
|
||||||
|
|
||||||
return new Promise<string[]>((yes, no) => {
|
return new Promise<string[]>((yes, no) => {
|
||||||
let keys = [];
|
let keys = [];
|
||||||
const stream = this.database.data.createKeyStream({ keyAsBuffer: false })
|
const stream = this.database.data.createKeyStream({ keyAsBuffer: false })
|
||||||
@ -526,6 +529,9 @@ export class CollectionQuery extends Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async deleteCollection() {
|
public async deleteCollection() {
|
||||||
|
if (!this.session.root)
|
||||||
|
throw new Error("No Permission!");
|
||||||
|
|
||||||
const { collection, document, collectionKey } = await this.resolve(this.path);
|
const { collection, document, collectionKey } = await this.resolve(this.path);
|
||||||
|
|
||||||
if (document) {
|
if (document) {
|
||||||
|
Reference in New Issue
Block a user