SDK
SDK Javascript v7.x
2

observe #

Available since 7.8.0

Retrieve a realtime document from a document

Arguments #

observe (index: string, collection: string, document: Document): Promise<RealtimeDocument>
ArgumentTypeDescription
index
string
Index name
collection
string
Collection name
document
Document
Document to observe

Usage #

const observer = new Observer(sdk);

const doc = await sdk.document.get('nyc-open-data', 'yellow-taxi', 'some-id');

const realtimeDoc = await observer.observe('nyc-open-data', 'yellow-taxi', doc);

console.log(realtimeDoc);
/*
  RealtimeDocument {
    _id: 'some-id',
    _source: {
      name: 'aschen',
      age: '29',
      _kuzzle_info: {
        author: '-1',
        createdAt: 1638432270522,
        updatedAt: null,
        updater: null
      }
    },
    deleted: false
  }
*/