NotesDatabase (JavaScript)

Represents a Notes® database.

Usage

To access the current database, use the database global object.
Other ways to access a database include:
  • To access an existing database when you know its server and file name, use getDatabase in NotesSession.
  • To access an existing database when you know its server and replica ID, use openDatabaseByReplicaID in NotesDbDirectory.
  • To locate an existing database when you know its server but not its file name, use the NotesDbDirectory class.
  • To access the current user's mail database, use openMailDatabase in NotesDbDirectory.
  • To open the default Web Navigator database, use getURLDatabase in NotesSession.
  • To access the available Domino® Directories and Personal Address Books, use getAddressBooks in NotesSession.
  • To test for the existence of a database with a specific server and file name before accessing it, use openDatabase or openDatabaseIfModified in NotesDbDirectory.
  • To create a new database from an existing database, use createCopy, createFromTemplate, or createReplica.
  • To create a new database from scratch, use createDatabase in NotesDbDirectory.
  • To access a database when you have a contained object such as NotesView, NotesDocument, NotesDocumentCollection, NotesACL, or NotesAgent, use the appropriate Parent (or ParentDatabase) property.

A database must be open before you can use all the properties and methods in the corresponding Database object. In most cases, the class library automatically opens a database for you. But see isOpen for the exceptions.

Domino® throws an exception when you attempt to perform an operation for which the user does not have appropriate access. The properties and methods that you can successfully use on a NotesDatabase object are determined by these factors:
  • The user's access level to the database, as determined by the database access control list. The ACL determines if the user can open a database, add documents to it, remove documents from it, modify the ACL, and so on.
  • The user's access level to the server on which the database resides, as determined by the Server document in the Domino® Directory.

Examples

This computed field displays the name of the local names.nsf database.
var db: NotesDatabase = session.getDatabase("", "names", false);
if (db != null) {
	return db.getTitle();
} else {
	return "No local names.nsf"
}