fix: Corregir scroll del emulador y serializacion circular de FindCursor en mongosh
This commit is contained in:
@@ -828,8 +828,14 @@ app.post('/api/admin/mongosh', async (req, res) => {
|
||||
})();
|
||||
`);
|
||||
|
||||
const result = await evalFn(dbProxy, ObjectId);
|
||||
res.json({ result });
|
||||
let finalResult = await evalFn(dbProxy, ObjectId);
|
||||
|
||||
// Si el resultado es un cursor de MongoDB (ej. db.collection.find()), lo convertimos a array
|
||||
if (finalResult && typeof finalResult === 'object' && typeof finalResult.toArray === 'function') {
|
||||
finalResult = await finalResult.toArray();
|
||||
}
|
||||
|
||||
res.json({ result: finalResult });
|
||||
} catch (err) {
|
||||
res.status(400).json({ error: err.message || String(err) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user