#community-help

Issue with Upserting Documents in Typesense Collection

TLDR Rahul has issues with upserting many documents on Typesense. Kishore Nallan mentioned it's a JS client issue and smaller document numbers or a newer version would work.

Powered by Struct AI
7
19mo
Solved
Join the chat
Apr 05, 2022 (19 months ago)
Rahul
Photo of md5-744410cce4f19b6e3c984bb1dd061c86
Rahul
07:10 AM
Hey guys,

I've one collection in typesense which has 33 columns. I'm upserting around 20000 documents at a single time with the batch_size 500 but it doesn't work. It throws the error "RangeError: Too many properties to enumerate". So if anyone knows then please get me a solution and also let me know if I'm doing anything wrong.

Thanks in advance
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:12 AM
Looks like a client error, what language client are you using?
Rahul
Photo of md5-744410cce4f19b6e3c984bb1dd061c86
Rahul
07:27 AM
Language client means the stack or anything else? stack is nodejs
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:31 AM
Yes, and what version of JS client?

This happens due to a JS limitation: https://stackoverflow.com/questions/9282869/are-there-limits-to-the-number-of-properties-in-a-javascript-object.

We added a work around here: https://github.com/typesense/typesense-js/pull/88

So it should work in recent JS client versions.
07:34
Kishore Nallan
07:34 AM
If you upserted with smaller number of documents at a single time, that should also work.
Rahul
Photo of md5-744410cce4f19b6e3c984bb1dd061c86
Rahul
07:35 AM
Yes smaller number of documents works fine
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:39 AM
Importing via curl supports millions of documents. We have to add a way to import a file from JS so that you can do a similar thing with the JS client.