typesense / typesense-js

JavaScript / TypeScript client for Typesense
https://typesense.org/docs/api
Apache License 2.0
400 stars 74 forks source link

retrieve function doesn't exist on 'documents' #123

Closed ArcoMul closed 2 years ago

ArcoMul commented 2 years ago

Description

According to the docs I can do:

client.collections('companies').documents('124').retrieve()

See: https://typesense.org/docs/0.22.2/api/documents.html#retrieve-a-document

But the .retrieve() function doesn't exist on what is returned from documents()

Steps to reproduce

-

Expected Behavior

Being able to retrieve a single document

Actual Behavior

TypeError: client.collections(...).documents(...).retrieve is not a function

Metadata

Typsense Version: 0.22.2 Typsense JS Version: 1.3.0

jasonbosco commented 2 years ago

@ArcoMul It sounds like you might be using SearchClient which only supports search operations. You want to use Client if you want to fetch documents by ID.

ArcoMul commented 2 years ago

Aii you are right, I didn't see/remember that part of the documentation. Thank you for your swift reply!