# JSDoc: Class: BNote

# Class: BNote

## BNote()

Trilium's main entity, which can represent text note, image, code note, file attachment etc.

## Constructor

#### new BNote()

Source:
  - becca/entities/bnote.js, line 40

### Extends

- AbstractBeccaEntity

### Members

#### __flatTextCache :string|null

##### Type:

- string | null

Source:
  - becca/entities/bnote.js, line 108

#### (protected) becca

Overrides:
  - AbstractBeccaEntity#becca
Source:
  - becca/entities/abstract_becca_entity.js, line 35

#### blobId :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 85

#### dateCreated :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 87

#### dateModified :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 89

#### isBeingDeleted :boolean

set during the deletion operation, before it is completed (removed from becca completely)

##### Type:

- boolean

Source:
  - becca/entities/bnote.js, line 98

#### isDecrypted :boolean

##### Type:

- boolean

Source:
  - becca/entities/bnote.js, line 103

#### isProtected :boolean

##### Type:

- boolean

Source:
  - becca/entities/bnote.js, line 83

#### mime :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 81

#### noteId :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 75

#### title :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 77

#### type :NoteType

##### Type:

- NoteType

Source:
  - becca/entities/bnote.js, line 79

#### utcDateCreated :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 91

#### utcDateModified :string

##### Type:

- string

Source:
  - becca/entities/bnote.js, line 93

### Methods

#### (protected) _getContent() → {string|Buffer}

Overrides:
  - AbstractBeccaEntity#_getContent
Source:
  - becca/entities/abstract_becca_entity.js, line 250

##### Returns:

Type
  string | Buffer

#### (protected) _setContent()

Overrides:
  - AbstractBeccaEntity#_setContent
Source:
  - becca/entities/abstract_becca_entity.js, line 128

#### addAttribute(type, name, valueopt, isInheritableopt, positionopt) → {BAttribute}

Adds a new attribute to this note. The attribute is saved and returned. See addLabel, addRelation for more specific methods.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | string |  |  | attribute type (label / relation)
`name` | string |  |  | name of the attribute, not including the leading ~/#
`value` | string | <optional> |  | value of the attribute - text for labels, target note ID for relations; optional.
`isInheritable` | boolean | <optional> | false |
`position` | int | null | <optional> | null |

Source:
  - becca/entities/bnote.js, line 1345

##### Returns:

Type
  BAttribute

#### addLabel(name, valueopt, isInheritableopt) → {BAttribute}

Adds a new label to this note. The label attribute is saved and returned.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`name` | string |  |  | name of the label, not including the leading #
`value` | string | <optional> |  | text value of the label; optional
`isInheritable` | boolean | <optional> | false |

Source:
  - becca/entities/bnote.js, line 1366

##### Returns:

Type
  BAttribute

#### addRelation(name, targetNoteId, isInheritableopt) → {BAttribute}

Adds a new relation to this note. The relation attribute is saved and returned.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`name` | string |  |  | name of the relation, not including the leading ~
`targetNoteId` | string |  |  |
`isInheritable` | boolean | <optional> | false |

Source:
  - becca/entities/bnote.js, line 1379

##### Returns:

Type
  BAttribute

#### (protected) beforeSaving()

Overrides:
  - AbstractBeccaEntity#beforeSaving
Source:
  - becca/entities/abstract_becca_entity.js, line 20

#### cloneTo(parentNoteId) → {Object}

##### Parameters:

Name | Type | Description
--- | --- | ---
`parentNoteId` |  |

Source:
  - becca/entities/bnote.js, line 1464

##### Returns:

Type
  Object

#### convertToParentAttachment() → {BAttachment|null}

Some notes are eligible for conversion into an attachment of its parent, note must have these properties: - it has exactly one target relation - it has a relation from its parent note - it has no children - it has no clones - the parent is of type text - both notes are either unprotected or user is in protected session Currently, works only for image notes. In the future, this functionality might get more generic and some of the requirements relaxed.

Source:
  - becca/entities/bnote.js, line 1516

##### Returns:

- null if note is not eligible for conversion

Type
  BAttachment | null

#### deleteNote(deleteIdopt, taskContextopt)

(Soft) delete a note and all its descendants.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`deleteId` | string | <optional> | null | optional delete identified
`taskContext` | TaskContext | <optional> | null |

Source:
  - becca/entities/bnote.js, line 1554

#### (protected) generateHash() → {string}

Overrides:
  - AbstractBeccaEntity#generateHash
Source:
  - becca/entities/abstract_becca_entity.js, line 59

##### Returns:

Type
  string

#### getAllNotePaths() → {Array.<Array.<string>>}

Gives all possible note paths leading to this note. Paths containing search note are ignored (could form cycles)

Source:
  - becca/entities/bnote.js, line 1186

##### Returns:

- array of notePaths (each represented by array of noteIds constituting the particular note path)

Type
  Array.<Array.<string>>

#### getAncestorNoteIds() → {Array.<string>}

Source:
  - becca/entities/bnote.js, line 1068

##### Returns:

Type
  Array.<string>

#### getAncestors() → {Array.<BNote>}

Source:
  - becca/entities/bnote.js, line 1042

##### Returns:

Type
  Array.<BNote>

#### getAttachmentById() → {BAttachment|null}

Source:
  - becca/entities/bnote.js, line 1149

##### Returns:

Type
  BAttachment | null

#### getAttachmentByTitle() → {BAttachment}

Source:
  - becca/entities/bnote.js, line 1176

##### Returns:

Type
  BAttachment

#### getAttachments() → {Array.<BAttachment>}

Source:
  - becca/entities/bnote.js, line 1131

##### Returns:

Type
  Array.<BAttachment>

#### getAttachmentsByRole() → {Array.<BAttachment>}

Source:
  - becca/entities/bnote.js, line 1164

##### Returns:

Type
  Array.<BAttachment>

#### getAttribute(type, name) → {BAttribute}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | string | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - becca/entities/bnote.js, line 605

##### Returns:

attribute of the given type and name. If there are more such attributes, first is returned. Returns null if there's no such attribute belonging to this note.

Type
  BAttribute

#### getAttributeValue(type, name) → {string|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | string | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - becca/entities/bnote.js, line 616

##### Returns:

attribute value of given type and name or null if no such attribute exists.

Type
  string | null

#### getAttributes(typeopt, nameopt) → {Array.<BAttribute>}

Beware that the method must not create a copy of the array, but actually returns its internal array (for performance reasons)

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`type` | string | <optional> | (optional) attribute type to filter
`name` | string | <optional> | (optional) attribute name to filter

Source:
  - becca/entities/bnote.js, line 358

##### Returns:

all note's attributes, including inherited ones

Type
  Array.<BAttribute>

#### getBestNotePath(hoistedNoteIdopt) → {Array.<string>}

Returns a note path considered to be the "best"

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`hoistedNoteId` | string | <optional> | 'root' |

Source:
  - becca/entities/bnote.js, line 1239

##### Returns:

array of noteIds constituting the particular note path

Type
  Array.<string>

#### getBestNotePathString(hoistedNoteIdopt) → {string}

Returns a note path considered to be the "best"

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`hoistedNoteId` | string | <optional> | 'root' |

Source:
  - becca/entities/bnote.js, line 1249

##### Returns:

serialized note path (e.g. 'root/a1h315/js725h')

Type
  string

#### getBranches() → {Array.<BBranch>}

Deprecated:
  - use getParentBranches() instead
Source:
  - becca/entities/bnote.js, line 200

##### Returns:

Type
  Array.<BBranch>

#### getChildBranches() → {Array.<BBranch>}

Source:
  - becca/entities/bnote.js, line 220

##### Returns:

Type
  Array.<BBranch>

#### getChildNotes() → {Array.<BNote>}

Source:
  - becca/entities/bnote.js, line 210

##### Returns:

Type
  Array.<BNote>

#### getContent() → {string|Buffer}

Source:
  - becca/entities/bnote.js, line 234

##### Returns:

Type
  string | Buffer

#### getDescendantNoteIds()

Deprecated:
  - use getSubtreeNoteIds() instead
Source:
  - becca/entities/bnote.js, line 989

#### getFlatText() → {string}

This is used for: - fast searching - note similarity evaluation

Source:
  - becca/entities/bnote.js, line 790

##### Returns:

- returns flattened textual representation of note, prefixes and attributes

Type
  string

#### getInheritingNotes() → {Array.<BNote>}

Source:
  - becca/entities/bnote.js, line 1094

##### Returns:

- returns only notes which are templated, does not include their subtrees in effect returns notes which are influenced by note's non-inheritable attributes

Type
  Array.<BNote>

#### getJsonContent() → {*}

Source:
  - becca/entities/bnote.js, line 241

##### Throws:

Error in case of invalid JSON

##### Returns:

Type
  *

#### getJsonContentSafely() → {*|null}

Source:
  - becca/entities/bnote.js, line 252

##### Returns:

valid object or null if the content cannot be parsed as JSON

Type
  * | null

#### getLabel(name) → {BAttribute|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - becca/entities/bnote.js, line 545

##### Returns:

label if it exists, null otherwise

Type
  BAttribute | null

#### getLabelValue(name) → {string|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - becca/entities/bnote.js, line 569

##### Returns:

label value if label exists, null otherwise

Type
  string | null

#### getLabelValues(nameopt) → {Array.<string>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | label name to filter

Source:
  - becca/entities/bnote.js, line 645

##### Returns:

all note's label values, including inherited ones

Type
  Array.<string>

#### getLabels(nameopt) → {Array.<BAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | label name to filter

Source:
  - becca/entities/bnote.js, line 637

##### Returns:

all note's labels (attributes with type label), including inherited ones

Type
  Array.<BAttribute>

#### getOwnedAttribute() → {BAttribute}

Source:
  - becca/entities/bnote.js, line 715

##### Returns:

attribute belonging to this specific note (excludes inherited attributes) This method can be significantly faster than the getAttribute()

Type
  BAttribute

#### getOwnedAttributeValue(type, name) → {string|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | string | attribute type (label, relation, etc.)
`name` | string | attribute name

Source:
  - becca/entities/bnote.js, line 627

##### Returns:

attribute value of given type and name or null if no such attribute exists.

Type
  string | null

#### getOwnedAttributes(typeopt, nameopt, valueopt) → {Array.<BAttribute>}

Beware that the method must not create a copy of the array, but actually returns its internal array (for performance reasons)

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | string | null | <optional> | null | (optional) attribute type to filter
`name` | string | null | <optional> | null | (optional) attribute name to filter
`value` | string | null | <optional> | null | (optional) attribute value to filter

Source:
  - becca/entities/bnote.js, line 690

##### Returns:

note's "owned" attributes - excluding inherited ones

Type
  Array.<BAttribute>

#### getOwnedLabel(name) → {BAttribute|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - becca/entities/bnote.js, line 551

##### Returns:

label if it exists, null otherwise

Type
  BAttribute | null

#### getOwnedLabelValue(name) → {string|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - becca/entities/bnote.js, line 575

##### Returns:

label value if label exists, null otherwise

Type
  string | null

#### getOwnedLabelValues(nameopt) → {Array.<string>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | label name to filter

Source:
  - becca/entities/bnote.js, line 661

##### Returns:

all note's label values, excluding inherited ones

Type
  Array.<string>

#### getOwnedLabels(nameopt) → {Array.<BAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | label name to filter

Source:
  - becca/entities/bnote.js, line 653

##### Returns:

all note's labels (attributes with type label), excluding inherited ones

Type
  Array.<BAttribute>

#### getOwnedRelation(name) → {BAttribute|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - becca/entities/bnote.js, line 563

##### Returns:

relation if it exists, null otherwise

Type
  BAttribute | null

#### getOwnedRelationValue(name) → {string|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - becca/entities/bnote.js, line 587

##### Returns:

relation value if relation exists, null otherwise

Type
  string | null

#### getOwnedRelations(nameopt) → {Array.<BAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | relation name to filter

Source:
  - becca/entities/bnote.js, line 677

##### Returns:

all note's relations (attributes with type relation), excluding inherited ones

Type
  Array.<BAttribute>

#### getParentBranches() → {Array.<BBranch>}

Source:
  - becca/entities/bnote.js, line 183

##### Returns:

Type
  Array.<BBranch>

#### getParentNotes() → {Array.<BNote>}

Source:
  - becca/entities/bnote.js, line 205

##### Returns:

Type
  Array.<BNote>

#### (abstract, protected) getPojo()

Overrides:
  - AbstractBeccaEntity#getPojo
Source:
  - becca/entities/abstract_becca_entity.js, line 82

#### (protected) getPojoToSave()

Overrides:
  - AbstractBeccaEntity#getPojoToSave
Source:
  - becca/entities/abstract_becca_entity.js, line 74

#### getRelation(name) → {BAttribute|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - becca/entities/bnote.js, line 557

##### Returns:

relation if it exists, null otherwise

Type
  BAttribute | null

#### getRelationValue(name) → {string|null}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name

Source:
  - becca/entities/bnote.js, line 581

##### Returns:

relation value if relation exists, null otherwise

Type
  string | null

#### getRelations(nameopt) → {Array.<BAttribute>}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string | <optional> | relation name to filter

Source:
  - becca/entities/bnote.js, line 669

##### Returns:

all note's relations (attributes with type relation), including inherited ones

Type
  Array.<BAttribute>

#### getRevisions() → {Array.<BRevision>}

Source:
  - becca/entities/bnote.js, line 1125

##### Returns:

Type
  Array.<BRevision>

#### getScriptEnv() → {string|null}

Source:
  - becca/entities/bnote.js, line 334

##### Returns:

JS script environment - either "frontend" or "backend"

Type
  string | null

#### getSearchResultNotes() → {Array.<BNote>}

Source:
  - becca/entities/bnote.js, line 900

##### Returns:

Type
  Array.<BNote>

#### getSortedNotePathRecords(hoistedNoteIdopt) → {Array.<NotePathRecord>}

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`hoistedNoteId` | string | <optional> | 'root' |

Source:
  - becca/entities/bnote.js, line 1208

##### Returns:

Type
  Array.<NotePathRecord>

#### getStrongParentBranches() → {Array.<BBranch>}

Returns strong (as opposed to weak) parent branches. See isWeak for details.

Source:
  - becca/entities/bnote.js, line 192

##### Returns:

Type
  Array.<BBranch>

#### getSubtree() → {Object}

Source:
  - becca/entities/bnote.js, line 923

##### Returns:

Type
  Object

#### getSubtreeNoteIds() → {Array.<string>}

Source:
  - becca/entities/bnote.js, line 982

##### Returns:

- includes the subtree root note as well

Type
  Array.<string>

#### getSubtreeNotesIncludingTemplated() → {Array.<BNote>}

Source:
  - becca/entities/bnote.js, line 868

##### Returns:

Type
  Array.<BNote>

#### getTargetRelations() → {Array.<BAttribute>}

Source:
  - becca/entities/bnote.js, line 1088

##### Returns:

Type
  Array.<BAttribute>

#### (protected) getUtcDateChanged()

Overrides:
  - AbstractBeccaEntity#getUtcDateChanged
Source:
  - becca/entities/abstract_becca_entity.js, line 27

#### hasAncestor() → {boolean}

Source:
  - becca/entities/bnote.js, line 1073

##### Returns:

Type
  boolean

#### hasAttribute(type, name, valueopt) → {boolean}

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` |  |  |  |
`name` |  |  |  |
`value` |  | <optional> | null |

Source:
  - becca/entities/bnote.js, line 475

##### Returns:

Type
  boolean

#### hasChildren() → {boolean}

Source:
  - becca/entities/bnote.js, line 215

##### Returns:

Type
  boolean

#### hasLabel(name, valueopt) → {boolean}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string |  | label name
`value` | string | <optional> | label value

Source:
  - becca/entities/bnote.js, line 504

##### Returns:

true if label exists (including inherited)

Type
  boolean

#### hasOwnedAttribute(type, name, valueopt) → {boolean}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`type` | string |  | attribute type (label, relation, etc.)
`name` | string |  | attribute name
`value` | string | <optional> | attribute value

Source:
  - becca/entities/bnote.js, line 595

##### Returns:

true if note has an attribute with given type and name (excluding inherited)

Type
  boolean

#### hasOwnedLabel(name, valueopt) → {boolean}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string |  | label name
`value` | string | <optional> | label value

Source:
  - becca/entities/bnote.js, line 525

##### Returns:

true if label exists (excluding inherited)

Type
  boolean

#### hasOwnedRelation(name, valueopt) → {boolean}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string |  | relation name
`value` | string | <optional> | relation value

Source:
  - becca/entities/bnote.js, line 539

##### Returns:

true if relation exists (excluding inherited)

Type
  boolean

#### hasRelation(name, valueopt) → {boolean}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string |  | relation name
`value` | string | <optional> | relation value

Source:
  - becca/entities/bnote.js, line 532

##### Returns:

true if relation exists (including inherited)

Type
  boolean

#### hasStringContent() → {boolean}

Source:
  - becca/entities/bnote.js, line 329

##### Returns:

true if the note has string content (not binary)

Type
  boolean

#### isDescendantOfNote(ancestorNoteId) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`ancestorNoteId` |  |

Source:
  - becca/entities/bnote.js, line 1280

##### Returns:

- true if ancestorNoteId occurs in at least one of the note's paths

Type
  boolean

#### isHiddenCompletely()

Source:
  - becca/entities/bnote.js, line 1258

##### Returns:

boolean - true if there's no non-hidden path, note is not cloned to the visible tree

#### isHtml() → {boolean}

Source:
  - becca/entities/bnote.js, line 312

##### Returns:

true if this note is HTML

Type
  boolean

#### isImage() → {boolean}

Source:
  - becca/entities/bnote.js, line 318

##### Returns:

true if this note is an image

Type
  boolean

#### isJavaScript() → {boolean}

Source:
  - becca/entities/bnote.js, line 304

##### Returns:

true if this note is JavaScript (code or attachment)

Type
  boolean

#### isJson() → {boolean}

Source:
  - becca/entities/bnote.js, line 299

##### Returns:

true if this note is of application/json content type

Type
  boolean

#### isLabelTruthy(name) → {boolean}

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | label name

Source:
  - becca/entities/bnote.js, line 510

##### Returns:

true if label exists (including inherited) and does not have "false" value.

Type
  boolean

#### isRoot() → {boolean}

Source:
  - becca/entities/bnote.js, line 294

##### Returns:

true if this note is the root of the note tree. Root note has "root" noteId

Type
  boolean

#### isStringNote()

Deprecated:
  - use hasStringContent() instead
Source:
  - becca/entities/bnote.js, line 324

#### markAsDeleted(deleteIdopt)

Mark the entity as (soft) deleted. It will be completely erased later. This is a low-level method, for notes and branches use `note.deleteNote()` and 'branch.deleteBranch()` instead.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`deleteId` |  | <optional> | null |

Overrides:
  - AbstractBeccaEntity#markAsDeleted
Source:
  - becca/entities/abstract_becca_entity.js, line 267

#### (protected) putEntityChange()

Overrides:
  - AbstractBeccaEntity#putEntityChange
Source:
  - becca/entities/abstract_becca_entity.js, line 44

#### removeAttribute(type, name, valueopt)

Removes given attribute name-value pair if it exists.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`type` | string |  | attribute type (label, relation, etc.)
`name` | string |  | attribute name
`value` | string | <optional> | attribute value (optional)

Source:
  - becca/entities/bnote.js, line 1324

#### removeLabel(name, valueopt)

Remove label name-value pair, if it exists.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string |  | label name
`value` | string | <optional> | label value

Source:
  - becca/entities/bnote.js, line 1440

#### removeRelation(name, valueopt)

Remove the relation name-value pair, if it exists.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string |  | relation name
`value` | string | <optional> | relation value (noteId)

Source:
  - becca/entities/bnote.js, line 1448

#### save() → {this}

Saves entity - executes SQL, but doesn't commit the transaction on its own

Overrides:
  - AbstractBeccaEntity#save
Source:
  - becca/entities/abstract_becca_entity.js, line 91

##### Returns:

Type
  this

#### saveAttachment(matchBy) → {BAttachment}

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`matchBy` | string | attachmentId | choose by which property we detect if to update an existing attachment. Supported values are either 'attachmentId' (default) or 'title'

Source:
  - becca/entities/bnote.js, line 1654

##### Returns:

Type
  BAttachment

#### saveRevision() → {BRevision|null}

Source:
  - becca/entities/bnote.js, line 1608

##### Returns:

Type
  BRevision | null

#### setAttribute(type, name, valueopt)

Update's given attribute's value or creates it if it doesn't exist

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`type` | string |  | attribute type (label, relation, etc.)
`name` | string |  | attribute name
`value` | string | <optional> | attribute value (optional)

Source:
  - becca/entities/bnote.js, line 1293

#### setContent(content, optsopt)

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`content` |  |  |

`opts`

object

<optional>

###### Properties

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`forceSave` | object | <optional> | false | will also save this BNote entity
`forceFrontendReload` | object | <optional> | false | override frontend heuristics on when to reload, instruct to reload

Source:
  - becca/entities/bnote.js, line 267

#### setLabel(name, valueopt)

Update's given label's value or creates it if it doesn't exist

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | string |  | label name
`value` | string | <optional> | label value

Source:
  - becca/entities/bnote.js, line 1424

#### setRelation(name, value)

Update's given relation's value or creates it if it doesn't exist

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | relation name
`value` | string | relation value (noteId)

Source:
  - becca/entities/bnote.js, line 1432

#### toggleAttribute(type, enabled, name, valueopt)

Based on enabled, the attribute is either set or removed.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`type` | string |  | attribute type ('relation', 'label' etc.)
`enabled` | boolean |  | toggle On or Off
`name` | string |  | attribute name
`value` | string | <optional> | attribute value (optional)

Source:
  - becca/entities/bnote.js, line 1391

#### toggleLabel(enabled, name, valueopt)

Based on enabled, label is either set or removed.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`enabled` | boolean |  | toggle On or Off
`name` | string |  | label name
`value` | string | <optional> | label value (optional)

Source:
  - becca/entities/bnote.js, line 1407

#### toggleRelation(enabled, name, valueopt)

Based on enabled, relation is either set or removed.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`enabled` | boolean |  | toggle On or Off
`name` | string |  | relation name
`value` | string | <optional> | relation value (noteId)

Source:
  - becca/entities/bnote.js, line 1416