Collection.byName()

Get a collection document by its name.

Signature

Collection.byName(name: string): CollectionDef | NullCollectionDef

Description

Each collection in a Fauna database is represented by a collection object, and each collection object has a name. This method gets the collection object by its name if it exists and is accessible.

Parameters

Parameter Type Required Description

name

String

Yes

Name of the collection to get.

Return value

One of:

Type Description

CollectionDef

Collection definition document.

NullCollectionDef

Collection object doesn’t exist or is inaccessible.

Examples

Collection.byName("Product")
{
  name: "Product",
  coll: Collection,
  ts: Time("2099-10-25T21:01:19.310Z")
}

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!