Getting empty array instead of data in Next.js

Hi everyone! I’m working with latest Next.js. I created database and 2 collections. One of collections is called - posts. I checked the connection, everything is fine. I checked that my items exists in Mongo DB compass. But when I’m trying to fetch them, I’m getting . Here are examples of my code

   try {
   	if (connection.isConnected) {
   		console.log("Using existing connection");
   	const db = await mongoose.connect(process.env.MONGO);
   	connection.isConnected = db.connections[0].readyState;
   } catch (error) {
   	throw new Error("Error connecting to database");
export const getPosts = async () => {
   try {
   	const posts = await Post.find();
   	return posts;
   } catch (err) {
   	throw new Error("Failed to fetch posts!");
````const BlogPage = async () => {
   const posts = await getPosts();
   return (
   	<div className={styles.container}>
   		{ any) => (
   			<div className={} key={}>
   				<PostCard post={item} />

The most common cause here is that the data is in a different database or collection(sometimes even different cluster) then is specified in the connection string or code.