NAME

sp_document - create a document object

SYNOPSIS

#include <sophia.h>

void *sp_document(void *object);

DESCRIPTION

sp_document(database): create new document for a transaction on a selected database.

The sp_document() function returns an object which is intended to be used in by any CRUD operations. Document might contain a key-value pair with any additional metadata.

EXAMPLE

void *o = sp_document(db);
sp_setstring(o, "key", "hello", 0);
sp_setstring(o, "value", "world", 0));
sp_set(db, o);

RETURN VALUE

On success, sp_document() returns an object pointer. On error, it returns NULL.

SEE ALSO

Sophia API