.get() function with id

Hi i am trying get an item by the _additional {id} property in typescript. This is my current attempt it does not work

if (postId === undefined) return undefined;
    const res = await weaviateClient.graphql
        .withFields("uri username hashtag timestamp _additional{id}")
            operator: "Equal",
            path: ["_additional", "id"],
            valueString: postId,
    return res.data.Get.Posts[0];

it does not work

Hi Mike, you can get the object ID as shown here:

That look right to me, but I think the ID filter perhaps looks incorrect. I think (source) the filter should look like this:

    operator: 'Equal',
    path: ['id'],
    valueText: postId,

I also notice you’re using valueString - pls note that string datatype has been deprecated and they will be changed to text when you upgrade Weaviate.

1 Like

Hi @Crazy_Mike - I’ve also moved this to our Support topic. :slight_smile: