Skip to content
On this page

Entry (extends: object)

An Object which represents a Entry within the Database.

INFO

Some Methods might return an errorMessage instead of a message if an unexpected error occurs. An errorMessage is only returned if the error is unexpected and not caused by the developer and also only set by the Client itself, not by the Server.

If an unexpected error occurs, it will return an errorMessage.

lua
{
    ["success"] = false,
    ["errorMessage"] = "An unexpected error occured."
}

If an error occurs which is caused by the developer (probl.), it will return a message.

lua
{
    ["success"] = false,
    ["message"] = "{Some error returned by the Server}"
}

:delete()

DANGER

This will delete the Entry from the Database. This action can not be undone. Use with caution.

Will Delete the Entry from the Database.

lua
--///

local Response = Entry:delete()

/*
{
    ["success"] = true,
    ["deletedEntries"] = 1
}
*/

:update(documentData: data)

DANGER

This will update the Entry with the given Data. This action can not be undone. Use with caution.

Will Update the Entry with the given Data and will also directly apply those changes within the Object which got provided.

lua
--///

local Response = Entry:update({
    ["name"] = "JavaScript",
    ["useless"] = true
})

/*
{
    ["success"] = true,
    ["updatedEntries"] = 1
}
*/

:getValues()

This will return the Values of the Entry as a Table.

lua
--///

local Values = Entry:getValues()

/*
{
    ["name"] = "JavaScript",
    ["type"] = "Programming Language",
    ["creator"] = "Brendan Eich",
    ["useless"] = true
    ["year"] = 1995,
    ["description"] = "JavaScript is a high-level, interpreted programming language. It is a language which is also characterized as dynamic, weakly typed, prototype-based and multi-paradigm.",
    ["links"] = {
        ["Wikipedia"] = "https://en.wikipedia.org/wiki/JavaScript",
        ["MDN"] = "https://developer.mozilla.org/en-US/docs/Web/JavaScript"
    }
}
*/

:getValue(string: key)

This will return the Value of the given Key.

lua
--///

local Value = Entry:getValue("name")

/*
"JavaScript"
*/