When listing the elements in the database I get the error "Converting circular structure to JSON", how can I solve it?
BD Model
const mongoose = require('mongoose');
const {Schema} = mongoose;
const PostSchema = new Schema({
text: { type: String, required: true},
created_at: Date,
});
module.exports = mongoose.model('Post', PostSchema);
List the data
import express from 'express';
const router = express.Router();
const Post = require('../model/post');
//todos los post
router.get('/posts', function (_req, res) {
const mini = Post.find();
res.json(mini);
});
module.exports = router;