SDK
SDK Javascript v7.x
2

get #

Available since 7.8.0

Gets a realtime document

This method uses the Document.get method under the hood to retrieve document.

Arguments #

get (index: string, collection: string, id: string, options: any): Promise<RealtimeDocument>
ArgumentTypeDescription
index
string
Index name
collection
string
Collection name
id
string
Document ID
options
any
Additional options

Usage #

const observer = new Observer(sdk);

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

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