Skip to content
On this page

request.collection

An Object to allow developers to get a Collection Object returned.

WARNING

Make Sure to check if the returned Collection Object is the actuall Object and not false before using it.

:get(string: collectionName)

Will Return a Collection Object without checking if it really exists within the Database. If it does not exist, erros my occour when trying to use the returned Collection Object.

lua
--///

local Collection = MarcSync.request.collection:get("myCollection")

/*
[Collection]
*/

:fetch(string: collectionName)

Will Return a Collection Object after checking if it really exists within the Database. If it does not exist, it will return false.

lua
--///

local Collection = MarcSync.request.collection:fetch("myCollection")

/*
[Collection]
*/

:create(string: collectionName)

Will Return a Collection Object after trying to create it within the Database. If it already exists, it will return false.

lua
--///

local Collection = MarcSync.request.collection:create("myCollection")

/*
[Collection]
*/