Fork me on GitHub
#xtdb
<
2021-12-02
>
Michael W15:12:36

I have stood up a stand-alone xtdb app using fulcro. When I insert new documents into the database, then fetch those documents using the built in netty http service, I see errors about the document not existing. In the fulcro app I see the document in full, but from the http api web console I see an error. Also notice the transaction time for me is a day in the past, even though I deleted all files from disk and inserted that document at the same time as the valid time. I'm wondering what I'm doing wrong?

sheluchin17:12:12

You might be running into some desync issues with the db atom in your state. https://github.com/roterski/fulcro-rad-xtdb/blob/main/src/main/roterski/fulcro/rad/database_adapters/xtdb/wrap_xtdb_save.clj#L148 Just a guess though. Not a high degree of confidence that this is your issue.

Michael W17:12:28

I didn't understand how to use the times in the query, and that they are sticky in the web console. I have it working perfectly now so I can read-only query into the documents created from the app. Really excellent system so far. I look forward to learning more xtdb.

🙏 1
refset23:12:53

Glad to hear, thanks for keeping us all posted :)

Piotr Roterski14:12:29

@UAB2NMK25 the fulcro-rad-xtdb plugin uses a https://docs.xtdb.com/language-reference/datalog-transactions/#transaction-functions named ::delta-update to perform writes. That means delta-update needs to be present in the db as a separate entity. If you follow https://github.com/fulcrologic/fulcro-rad-demo/blob/develop/src/xtdb/com/example/components/xtdb.clj#L9 and use start-databases then https://github.com/roterski/fulcro-rad-xtdb/blob/main/src/main/roterski/fulcro/rad/database_adapters/xtdb/start_databases.clj#L27-L28 this transaction function as a part of the initialisation process but it looks like you’re missing it so I’m not sure if you’re calling this start-databases or you’re starting the xtdb node manually somewhere else - that’s would be fine but you’d need to insert this transaction function manually as well to use the plugin’s writes. UPDATE: I reread your problem and now I get that it was about querying for that function from the web console, so my answer is not very relevant. 😅 sorry for the confusion

1
Michael W15:12:50

Yes I have that transaction function, my issue was the xtdb web console, not the fulcro app. The fulcro app worked great, I was just struggling with how to properly query documents by valid time and transaction time in the console. It's all resolved though and working well now.

🙌 2