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

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.