#community-help

Importing Document IDs for Future Updates in Node.js Typesense Client

TLDR Priyank needs help using document IDs for future updates. Kishore Nallan suggests sending return_id=true GET parameter and corrects the field name in the code snippet.

Powered by Struct AI

1

Feb 06, 2023 (10 months ago)
Priyank
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Priyank
11:40 AM
I want use this id's in future to update the documents
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:55 AM
Send return_id=true to the import API as GET parameter. Every row in the import response will now contain the id of the document imported. You can use this for future updates.
Priyank
Photo of md5-a9a351e11d64f05b41fec183816a0cda
Priyank
11:56 AM
i am usinmg nodejs typesense client
11:57
Priyank
11:57 AM
where should i include this return ids field
11:57
Priyank
11:57 AM
  const ids = await TypesenseClient.collections("listing")
    .documents()
    .import(servicesForTypesense, { action: "create", return_ids: "true" });

Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:57 AM
return_id (singular) but otherwise correct

1