Hello guys, So I'm getting the doc from my couchdb...
# community-help
j
Hello guys, So I'm getting the doc from my couchdb but the when I try to index if it my collection is doesn't work, does anyone know the cause of this issue?
k
Can you please tell me what error you are getting?
j
but x_top is there in the document, here's a gist to the code https://gist.github.com/jamessandy/b69d85a3300a6c1465ae5d70901198d6
k
The collection schema defines a
'default_sorting_field': 'x_top'
If you define a default sorting field, that value should always be present in the document. The document you tried to index didn't have this field.
j
it does have
k
Can you please try inserting one document outside separately? I'm pretty sure that one of the document is not having that field. You can try catching that exception and printing the value of the document.
j
verified?
k
I don't follow you
j
these are the values of the doc
k
To unblock, remove the
default_sorting_field
configuration and see if it works.
j
it throws a new error
k
Then there is something is certainly wrong in the document you are passing into Typesense, Please look carefully.
j
this is the entire document, can't seem to see anything wrong
k
Can you please update this gist(https://gist.github.com/jamessandy/b69d85a3300a6c1465ae5d70901198d6) with that data example? I can then try running it.
j
I'm getting the data from my couchdb database
j
@James Sandy On a side note, it looks like Lines 121 and 126 are missing "await"
Also, doesn't Line 4 need an await or callback of sorts? I'd imagine
.get
is async, when getting data from couchdb
Essentially, you want to make sure that "doc" is an actual JS object when you console.log it just before sending it to Typesense