IModelDb Class

An iModel database file. The database file is either a local copy (briefcase) of an iModel managed by iModelHub or a read-only snapshot used for archival and data transfer purposes.

see Accessing iModels

see About IModelDb


Extended by



Name Description
abandonChanges(): void Abandon pending changes in this iModel.  
cancelSnap(sessionId: string): void Cancel a previously requested snap.  
clearCaches(): void Clear all in-memory caches held in this IModelDb.  
clearSqliteStatementCache(): void Empty the SqliteStatementCache for this iModel. Deprecated  
clearStatementCache(): void Empty the ECSqlStatementCache for this iModel. Deprecated  
close(): void Close this IModel, if it is currently open.  
computeProjectExtents(options?: ComputeProjectExtentsOptions): ComputedProjectExtents Compute an appropriate project extents for this iModel based on the ranges of all spatial elements.  
constructEntity<T extends Entity>(props: EntityProps): T extends Entity Construct an entity (Element or Model) from an iModel.  
containsClass(classFullName: string): boolean Query if this iModel contains the definition of the specified class.  
deleteFileProperty(prop: FilePropertyProps): DbResult delete a "file property" from this iModel  
embedFont(prop: FontProps): FontProps    
exportGraphics(exportProps: ExportGraphicsOptions): DbResult Export meshes suitable for graphics APIs from arbitrary geometry in elements in this IModelDb.  
exportPartGraphics(exportProps: ExportPartGraphicsOptions): DbResult Exports meshes suitable for graphics APIs from a specified GeometryPart  
getBriefcaseId(): BriefcaseId Get the briefcase Id of this iModel  
getGeoCoordinatesFromIModelCoordinates(requestContext: ClientRequestContext, props: string): Promise<GeoCoordinatesResponseProps> Get the GeoCoordinate (longitude, latitude, elevation) corresponding to each IModel Coordinate point in the input  
getGeometryContainment(requestContext: ClientRequestContext, props: GeometryContainmentRequestProps): Promise<GeometryContainmentResponseProps> Get the clip containment status for the supplied elements Beta  
getGuid(): GuidString Get the GUID of this iModel.  
getIModelCoordinatesFromGeoCoordinates(requestContext: ClientRequestContext, props: string): Promise<IModelCoordinatesResponseProps> Get the IModel coordinate corresponding to each GeoCoordinate point in the input  
getJsClass<T extends undefined>(classFullName: string): T extends undefined Get the JavaScript class that handles a given entity class.  
getMassProperties(requestContext: ClientRequestContext, props: MassPropertiesRequestProps): Promise<MassPropertiesResponseProps> Get the mass properties for the supplied elements Beta  
Get metadata for a class.  
importSchemas(requestContext: ClientRequestContext, schemaFileNames: string[]): Promise<void> Import an ECSchema.  
isBriefcaseDb(): this Type guard for instanceof BriefcaseDb  
isSnapshotDb(): this Type guard for instanceof SnapshotDb  
prepareStatement(sql: string): ECSqlStatement Prepare an ECSQL statement.  
query(ecsql: string, bindings?: any[] | object, limitRows?: number, quota?: QueryQuota, priority?: QueryPriority, abbreviateBlobs?: false | true): AsyncIterableIterator<any> Execute a query and stream its results  
queryEntityIds(params: EntityQueryParams): Id64Set Query for a set of entity ids, given an EntityQueryParams  
queryFilePropertyBlob(prop: FilePropertyProps): Uint8Array | undefined Query a "file property" from this iModel, as a blob.  
queryFilePropertyString(prop: FilePropertyProps): string | undefined Query a "file property" from this iModel, as a string.  
queryNextAvailableFileProperty(prop: FilePropertyProps): number Query for the next available major id for a "file property" from this iModel.  
queryRowCount(ecsql: string, bindings?: any[] | object): Promise<number> Compute number of rows that would be returned by the ECSQL.  
querySchemaVersion(schemaName: string): string | undefined Query for a schema of the specified name in this iModel.  
readFontJson(): string    
requestSnap(requestContext: ClientRequestContext, sessionId: string, props: SnapRequestProps): Promise<SnapResponseProps>    
restartQuery(token: string, ecsql: string, bindings?: any[] | object, limitRows?: number, quota?: QueryQuota, priority?: QueryPriority): AsyncIterableIterator<any> Execute a query and stream its results  
saveChanges(description?: string): void Commit pending changes to this iModel.  
saveFileProperty(prop: FilePropertyProps, strValue: string | undefined, blobVal?: Uint8Array): DbResult Save a "file property" to this iModel  
tryPrepareStatement(sql: string): ECSqlStatement | undefined Prepare an ECSQL statement.  
updateEcefLocation(ecef: EcefLocation): void Update the EcefLocation of this iModel.  
updateIModelProps(): void Update the IModelProps of this iModel in the database.  
updateProjectExtents(newExtents: AxisAlignedBox3d): void Update the project extents for this iModel.  
withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T): T Use a prepared ECSQL statement.  
findByFilename(fileName: string): IModelDb | undefined Static Find an opened instance of any subclass of IModelDb, by filename  
findByKey(key: string): IModelDb Static Find an open IModelDb by its key.  
Invoke a callback on each property of the specified class, optionally including superclass properties.  
tryFindByKey(key: string): IModelDb | undefined Static Attempt to find an open IModelDb by key.  
validateSchemas(filePath: string, forReadWrite: boolean): SchemaState Static Determines if the schemas in the Db must or can be upgraded by comparing them with those included in the  

Inherited methods

Name Inherited from Description
cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d): Point3d IModel Convert a Cartographic to a point in this iModel's Spatial coordinates using its ecefLocation.
ecefToSpatial(ecef: XYAndZ, result?: Point3d): Point3d IModel Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its ecefLocation.
getEcefTransform(): Transform IModel Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its ecefLocation.
getRpcProps(): IModelRpcProps IModel Return a token for RPC operations.
setEcefLocation(ecef: EcefLocationProps): void IModel Set the EcefLocation for this iModel.
setGeographicCoordinateSystem(geoCRS: GeographicCRSProps): void IModel  
spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic IModel Convert a point in this iModel's Spatial coordinates to a Cartographic using its ecefLocation.
spatialToEcef(spatial: XYAndZ, result?: Point3d): Point3d IModel Convert a point in this iModel's Spatial coordinates to an ECEF point using its ecefLocation.
getDefaultSubCategoryId(categoryId: Id64String): Id64String Static IModel Get the default subCategoryId for the supplied categoryId


Name Type Description
_edit ProtectedStatic "StandaloneEdit" = "StandaloneEdit"    
_fontMap Protected undefined | FontMap    
codeSpecs Accessor ReadOnly CodeSpecs Get the CodeSpecs in this IModel.  
defaultLimit Static 1000    
elements IModelDb.Elements    
fontMap Accessor ReadOnly FontMap    
iModelId Accessor ReadOnly GuidString The Guid that identifies this iModel.  
isBriefcase Accessor ReadOnly boolean Returns true if this is an iModel from iModelHub (briefcase)  
isReadonly Accessor ReadOnly boolean Check if this iModel has been opened read-only or not.  
isSnapshot Accessor ReadOnly boolean Returns true if this is a snapshot iModel  
maxLimit Static 10000    
models IModelDb.Models    
onBeforeClose BeEvent<() => void> Event called when the iModel is about to be closed  
onChangesetApplied BeEvent<() => void> Event called after a changeset is applied to this IModelDb.  
pathName Accessor ReadOnly string Get the full path fileName of this iModelDb  
relationships Accessor ReadOnly Relationships Get the linkTableRelationships for this IModel  
txns TxnManager   Beta   
views IModelDb.Views    

Inherited properties

Name Type Inherited from Description
changeSetId Accessor ReadOnly string | undefined IModel The Id of the last changeset that was applied to this iModel.
contextId Accessor ReadOnly GuidString | undefined IModel The Guid that identifies the context that owns this iModel.
dictionaryId Static Id64String IModel The Id of the dictionary model.
ecefLocation Accessor ReadOnly EcefLocation | undefined IModel The EcefLocation of the iModel in Earth Centered Earth Fixed coordinates.
geographicCoordinateSystem Accessor GeographicCRS | undefined IModel  
globalOrigin Accessor Point3d IModel An offset to be applied to all spatial coordinates.
isGeoLocated Accessor ReadOnly boolean IModel True if this iModel has an EcefLocation.
key Accessor ReadOnly string IModel Get the key that was used to open this iModel. This is the value used for RPC communications.
name string IModel Name of the iModel
openMode OpenMode IModel The OpenMode used for this IModel.
projectExtents Accessor AxisAlignedBox3d IModel The volume, in spatial coordinates, inside which the entire project is contained.
repositoryModelId Static Id64String IModel The Id of the repository model.
rootSubject RootSubjectProps IModel The name and description of the root subject of this iModel
rootSubjectId Static Id64String IModel The Id of the root subject element.

Object Literals

Name Description
_concurrentQueryStats Protected  

Defined in

Last Updated: 25 February, 2021