Skip to content

Latest commit

 

History

History
62 lines (36 loc) · 1.95 KB

updating-entities.js.markdown

File metadata and controls

62 lines (36 loc) · 1.95 KB

Update Entities


{NOTE: }

  • To modify existing documents:

    • Retrieve documents from the database using load or by a query.
      The entities loaded from the documents are added to the internal entities map that the Session manages.

    • Edit the properties you wish to change.
      The session will track all changes made to the loaded entities.

    • Save to apply the changes.
      Once saveChanges() returns it is guaranteed that the data is persisted in the database.

  • In this page:

{NOTE/}


{PANEL: Load a document & update}

  • In this example we load a company document and update its postalCode property.

{CODE:nodejs sample_document@client-api\session\updateDocuments.js /}

{CODE:nodejs load-company-and-update@client-api\session\updateDocuments.js /}

{PANEL/}

{PANEL: Query for documents & update}

  • In this example we query for company documents whose postalCode property is 12345,
    and modify this property for the matching documents.

{CODE:nodejs query-company-and-update@client-api\session\updateDocuments.js /}

{PANEL/}

Related Articles

Session

Querying

Document Store