Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
JavaScript
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667#!/usr/bin/env node
// Debug what's happening with the backfill queries
import { connect } from './database.mjs';import { config } from 'dotenv';
config({ path: '../.env' });
const database = await connect();const moods = database.db.collection('moods');const users = database.db.collection('users');const handles = database.db.collection('@handles');
console.log('๐ Debugging backfill queries\n');
// Get one mood without atproto.rkeyconst mood = await moods.findOne({ deleted: { $ne: true }, 'atproto.rkey': { $exists: false }});
if (!mood) { console.log('โ No moods without ATProto records found'); await database.disconnect(); process.exit(0);}
console.log('๐ Sample mood:');console.log(` _id: ${mood._id}`);console.log(` user: ${mood.user}`);console.log(` mood: ${mood.mood.substring(0, 50)}`);console.log(` when: ${mood.when}`);console.log(` atproto: ${JSON.stringify(mood.atproto)}`);
console.log('\n๐ Looking up user...');const user = await users.findOne({ _id: mood.user });
if (!user) { console.log('โ User NOT FOUND with _id:', mood.user);} else { console.log('โ
User found:'); console.log(` _id: ${user._id}`); console.log(` email: ${user.email}`); console.log(` atproto.did: ${user.atproto?.did || 'NOT SET'}`); console.log(` atproto.password: ${user.atproto?.password ? '***' : 'NOT SET'}`);}
console.log('\n๐ Looking up handle...');const handleDoc = await handles.findOne({ _id: mood.user });
if (!handleDoc) { console.log('โ Handle NOT FOUND with _id:', mood.user); // Try to find handle by other means console.log('\n๐ Searching all handles to see structure...'); const allHandles = await handles.find({}).limit(3).toArray(); console.log('Sample handles:', JSON.stringify(allHandles, null, 2)); } else { console.log('โ
Handle found:'); console.log(` _id: ${handleDoc._id}`); console.log(` handle: ${handleDoc.handle}`);}
await database.disconnect();