Hello, I was hoping someone can help me with this. I am trying to get an array of users to hand off to Passport from my Atlas Cluster. I basically copied this code straight from the Atlas Docs (except the .env variables).
I run into 2 problems:
I cant get the last console .log to wait for the run function to finish. I get a pending promise, and I can’t “await” the run().
The commented out Timeout code will give me the users but then its still a Promise. And nothing I have done with a .then statement has managed to get anything but another Promise back. I feel like I am missing something fundamental here.
What I am trying to get:
const users = [
{
id: ‘1661622049062’,
name: “John Doe”,
email: “test@test.com”,
password: “PW1”
},
{
id: ‘1661622093607’,
name: “Jane Doe”,
email: “test2@test2.com”,
password: “PW2”
}
]
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.