Skip to content

emplace is not available for single index updates necessitating the use of import #313

@jjnistico

Description

@jjnistico

I noticed different behavior between documents().import(, { action: "emplace" }) and documents().upsert(, { action: "emplace"}), with the latter working with the behavior of an upsert instead of update when a partial document is passed.

In src/Typesense/Documents.ts:220, the DocumentWriteParameters action property is overwritten by the Object.assign call, negating the ability to pass an action to the upsert call.

Are all actions valid for the upsert call? Perhaps the line could be changed to

  Object.assign({}, options, { action: options.action ?? "upsert" })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions