X DevAPI User Guide

3.1 CRUD Operations Overview

CRUD operations are available as methods, which operate on Schema objects. The available Schema objects consist of Collection objects, containing Documents, or Table objects consisting of rows and Collections containing Documents.

The following table shows the available CRUD operations for both Collection and Table objects.

Operation

Document

Relational

Create

Collection.add()

Table.insert()

Read

Collection.find()

Table.select()

Update

Collection.modify()

Table.update()

Delete

Collection.remove()

Table.delete()

Database Object Classes

Figure 3.1 Database Object - Class Diagram

The DatabaseObject class contains the following general functions: getSession(): XSessionObj, getSchema(): SchemaObj, getName(): String, existsInDatabase(): Boolean|Unknown. The Schema class contains the following functions: getCollections() and getTables() are browse functions. getCollection(): CollectionObj, getTable(): TableObj, and getCollectionAsTable(): TableObj are DbObject instance functions. createCollection() is a create function. The Collection class contains the following functions: add(): CollectionInsertObj, find(): CollectionFindObj, modify(): CollectionUpdateObj, and remove(): CollectionDeleteObj are CRUD functions. createIndex(), dropIndex(), and getIndexes() are index functions. newDoc() and count(): Integer are document and structure functions. The Table class contains the following functions: insert(): InsertObj, select(): SelectObj, update(): UpdateObj, and delete(): DeleteObj are relational SQL CRUD functions. dropIndex() and getIndexes() are index functions. count(): Integer is a general function.