Spaces:
Build error
Build error
| import db from './src/lib/db'; | |
| const docs = db.prepare(` | |
| SELECT id, title, tags | |
| FROM documents | |
| WHERE namespace = 'NOTES' AND tags IS NOT NULL | |
| LIMIT 5 | |
| `).all(); | |
| console.log('Raw DB Tags Content:'); | |
| docs.forEach((d: any) => { | |
| console.log(`Title: ${d.title}`); | |
| console.log(`Tags (Raw): ${d.tags}`); | |
| try { | |
| const parsed = JSON.parse(d.tags); | |
| console.log('Tags (Parsed):', JSON.stringify(parsed, null, 2)); | |
| console.log('Is Array?', Array.isArray(parsed)); | |
| if (Array.isArray(parsed)) { | |
| console.log('Element types:', parsed.map((x: any) => typeof x)); | |
| } | |
| } catch (e) { | |
| console.log('Parse Error:', e); | |
| } | |
| console.log('---'); | |
| }); | |