@@ -37,7 +37,7 @@ By the end, you'll have hands-on experience setting up Postgres change data capt
3737 -p 8108:8108 \
3838 -v ./typesense-data:/data \
3939 --restart on-failure \
40- typesense/typesense:28 .0 \
40+ typesense/typesense:29 .0 \
4141 --data-dir /data \
4242 --api-key=my-api-key \
4343 --enable-cors
@@ -107,8 +107,18 @@ By the end, you'll have hands-on experience setting up Postgres change data capt
107107
108108 ``` elixir
109109 def transform (action, record, changes, metadata) do
110- Map .take (record, [" id" , " name" , " price" ])
110+ record
111+ |> Map .take ([" id" , " name" , " price" ])
112+ # Typesense requires `id` to be a string
113+ |> Map .update (" id" , nil , fn id ->
114+ cond do
115+ is_binary(id) - > id
116+ is_integer(id) - > Integer .to_string (id)
117+ true -> to_string (id)
118+ end
119+ end )
111120 end
121+
112122 ```
113123
114124 This transform will take the ` id ` , ` name ` , and ` price ` fields from the ` products ` table and use them to create a new document in Typesense.
@@ -130,6 +140,7 @@ By the end, you'll have hands-on experience setting up Postgres change data capt
130140 In the Typesense card, enter your Typesense configuration:
131141
132142 - Host: ` http://host.docker.internal:8108 `
143+ - If that doesn't work, your host and port may be ` http://typesense-server:8108 `
133144 - Collection: ` products `
134145 - API Key: ` my-api-key `
135146
@@ -264,4 +275,4 @@ Now you're ready to connect your own database to Sequin and start streaming chan
264275 <Card title = " Guide: Setting up a Typesense sink" icon = " search" href = " /how-to/stream-postgres-to-typesense" >
265276 Setup a Typesense sink to keep your search index in sync.
266277 </Card >
267- </CardGroup >
278+ </CardGroup >
0 commit comments