NotesDocument (JavaScript)

Represents a document in a database.

Creation

To create a new NotesDocument object, use createDocument in NotesDatabase.

Access

To access existing documents:
  • To get all the documents in a database, use getAllDocuments in NotesDatabase.
  • To get a document based on its position in a view, use a NotesView object.
  • To get a document based on its position in a response hierarchy, use a NotesView object. To get all documents that are responses to a particular document, use getResponses in NotesDocument. To get a response document's parent document, use getParentDocumentUNID in NotesDocument followed by getDocumentByUNID in NotesDatabase.
  • To get all the documents that match a full-text search query, use FTSearch in NotesDatabase or FTSearch in NotesView.
  • To get all the documents in a database that meet search criteria, where the criteria are defined using the formula language, use search in NotesDatabase.
  • To get a document based on its note ID or UNID, use getDocumentByID or getDocumentByUNID in NotesDatabase.

Once you have a view, you can navigate to a specific document using methods in the NotesView class.

Once you have a collection of documents, you can navigate to a specific document using methods in the NotesDocumentCollection class.

Saving changes

After you create, modify, or delete a document, you must save the changes by calling the save method. If you don't call save before the program finishes, all of your changes to a NotesDocument object are lost.

If you create and save a new document without adding any items to it, the document is saved with one item $UpdatedBy. This item contains the name of the creator of the document.

Encryption

A program attempts to decrypt an encrypted document the first time the program accesses one of the NotesDocument properties or methods. If decryption fails, an exception is thrown.

XSP context

The NotesDocument class works directly with the Domino® data store. To work with a Domino® document data source on an XPage, see NotesXspDocument.