exists()

Test if a collection exists.

Signature

exists(): Boolean

Description

The exists() method tests if a collection instance exists.

Use exists() to find if the document can be read. If exists() returns false, there is a corresponding cause field that indicates the reason that the document can’t be read. Possible reasons are:

  • Not found.

  • Permission denied.

If the exists field isn’t present, the document may or may not exist.

Parameters

None

Return value

Type Description

Boolean

true = The collection exists.
false = The collection doesn’t exist.

Examples

Collection.byName("Product").exists()
true

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!