Collection Management

Below are Monaca Backend Management API for Collections.

Method Description
Collection.list() Get a List of Collections
Collection.create() Create a New Collection Object
Collection.drop() Drop a Collection
Collection.setConfig() Configure a Collection
Collection.getConfig() Get a Configuration of a Collection
Collection.getPropertyNames() Get CollectionItems’ Property Names

Collection.list()

Get a list of Collections.

Collection.list()

Parameter

  • None

Return Value

Name Type Description
items Array Collection Definitions

Collection.create()

Create a new Collection object.

Collection.create(_id: String, isInsertable: Boolean, defaultPublicPermission: String)

Parameter

Name Type Description
_id String Collection name
isInsertable Boolean Whether the collection can be inserted or not
defaultPublicPermission String Public permissions of the Collection which can be "", "r", "w" or "rw"

Return Value

  • None

Errors Code

Errors are returned as Error object.

Code Description
-32602 Invalid params

Collection.drop()

Drop a Collection.

Collection.drop(_id: String)

Parameter

Name Type Description
_id String Collection name

Return Value

  • None

Errors Code

Errors are returned as Error object.

Code Description
-32602 Invalid params

Collection.setConfig()

Configure a Collection.

Collection.setConfig(_id: String, isInsertable: Boolean, defaultPublicPermission: String)

Parameter

Name Type Description
_id String Collection name
isInsertable Boolean Whether the collection can be inserted or not
defaultPublicPermission String Public permissions of the Collection which can be "", "r", "w" or "rw"

Return Value

  • None

Errors Code

Errors are returned as Error object.

Code Description
-32602 Invalid params

Collection.getConfig()

Get the configuration of a Collection.

Collection.getConfig(_id: String)

Parameter

Name Type Description
_id String Collection name

Return Value

Name Type Description
config JSON Object Collection Definition

Errors Code

Errors are returned as Error object.

Code Description
-32602 Invalid params

Collection.getPropertyNames()

Get displayable property names by internally fetching the latest 100 CollectionItems of a Collection.

Collection.getPropertyNames(_id: String)

Parameter

Name Type Description
_id String Collection name

Return Value

Name Type Description
names Array Array of property names

Errors Code

Errors are returned as Error object.

Code Description
-32602 Invalid params

See Also: