Link Search Menu Expand Document

Deleting Data

Table of contents

  1. Delete document
  2. Delete collection
  3. Delete sub collection
  4. Delete by query

Delete single model or all collection.

Delete document

To delete single document pass key to manager

Example Usage

await User.collection.delete({key: user_key});

Delete collection

Delete all documents from collection

Example Usage

await User.collection.delete();

Delete sub collection

Deleting any document not delete it’s sub collection you need to delete them separately but you can pass child=True to delete all its sub collections

Suppose you want to delete post and all it’s reviews

await Post.collection.delete({key: post_key, child: true})

This will delete the post and all it’s sub collection in this case reviews if reviews has any other sub collection these will also delete.

Delete by query

FireO also allow you to delete multiple documents by query

await Post.collection.where("title", "==", "some title").delete();

Copyright © 2019 FireO All rights reserved. Powered by OctaByte