search: keywords: ['Java API', 'ODatabaseDocument', 'class', 'count class', 'countClass']

ODatabaseDocument - countClass()

This method returns the number of records in a given database class.

Counting Records by Class

OrientDB organizes data by a database class, which is an instance of the OClass class. Using this method, you can retrieve a count of the number of records in a given database class.

Syntax

// METHOD 1
long ODatabaseDocument().countClass(String name)

// METHOD 2
long ODatabaseDocument().countClass(String name, Boolean isPolymorphic)
ArgumentTypeDescription
nameStringDefines the database class name
isPolymorphicBooleanDefines whether the class has sub-classes

Return Value

This method returns a Long instance that represents the number of records on the given database class.