Class: Document

Document

The Document class wraps a document.

Cannot directly be instantiated

Constructor

new Document(doc, opts)

Creates a Document.

Parameters:
Name Type Description
doc object

The initial document object. This Document object will be extended with doc properties.

opts object

Options overriding the ones from the Operation object.

Properties
Name Type Description
repository string

The Repository object linked to this document.

Source:
Example
var Nuxeo = require('nuxeo')
var nuxeo = new Nuxeo({
 baseUrl: 'http://localhost:8080/nuxeo',
 auth: {
   username: 'Administrator',
   password: 'Administrator',
 }
});
nuxeo.operation('Document.GetChild')
  .input('/default-domain')
  .params({
    name: 'workspaces',
  })
  .execute().then((res) => {
       // res.uid !== null
    // res.title === 'Workspaces'
  }).catch(error => throw new Error(error));

Methods

get(propertyName) → {Document}

Gets a document property.

Parameters:
Name Type Description
propertyName string

The property name, such as 'dc:title', 'file:filename', ...

Source:
Returns:
Type
Document

isFolder() → {Boolean}

Returns weither this document is folderish or not.

Source:
Returns:

true if this document is folderish, false otherwise.

Type
Boolean

save(opts) → {Promise}

Saves the document. It updates only the 'dirty properties' set through the Document#set method.

Parameters:
Name Type Description
opts object

Options overriding the ones from the Document object.

Source:
Returns:

A promise object resolved with the updated document.

Type
Promise

set(properties) → {Document}

Sets document peroperties.

Parameters:
Name Type Description
properties object

The properties to set.

Source:
Returns:
Type
Document
Example
doc.set({
  'dc:title': 'new title',
  'dc:description': 'new description',
});