This repository was archived by the owner on Aug 7, 2023. It is now read-only.
Database search (express.js) #508
Answered
by
Sokhavuth
scriptyyy13
asked this question in
Help
-
|
Is there any normal way to do a deta base search on an incomplete name? I tried to make such a search, but it did not work and gave the result only when the value was fully entered. CODE: app.post('/search', async (req, res) => {
const { items } = await an.fetch({"name": req.body.name});
if (items) { res.redirect('./anime/'+items[0].key); } else { res.redirect('./anime/2'); }
}); |
Beta Was this translation helpful? Give feedback.
Answered by
Sokhavuth
Sep 29, 2022
Replies: 1 comment 1 reply
-
|
Maybe you could do like this {"name?contains": req.body.name}. It works for string and array. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
scriptyyy13
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe you could do like this {"name?contains": req.body.name}. It works for string and array.
https://docs.deta.sh/docs/base/queries