Unable to connect db because of "throw new MongoParseError('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');"

Hi @olena_dunamiss welcome to the community!

So a big welcome to the coders club! What I gathered so far is that you’re trying to use Apollo GrapQL to connect to a MongoDB database, to create a todo list app. Is this correct?

Could you provide some more details:

  • What is the tutorial that you’re trying to follow?
  • The error seems to say that DB_URI contains invalid MongoDB URI connection string. Could you insert a console.log(DB_URI) statement somewhere before new MongoClient to verify the content of that variable

If you’re just starting to code, I would suggest you to learn MongoDB in isolation first (without Apollo or GraphQL) by following MongoDB and Node.js Tutorial - CRUD Operations.

Regarding MongoDB + Node, I would also suggest you take a look at the free MongoDB University courses: M001 MongoDB Basics and M220JS MongoDB for JavaScript Developers (although please note that M220JS assumes some familiarity with Javascript/Node).

Best regards
Kevin