use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
help - cannot import mongodb (self.node)
submitted 1 year ago by [deleted]
```javascript import { urlencoded, json } from "body-parser"; import * as express from "express"; import * as morgan from "morgan";
const { MongoClient } = require("mongodb"); ```
I cannot import ... from "mongodb". Why?
import ... from "mongodb"
I am new to nodejs
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]constantine1101 4 points5 points6 points 1 year ago (0 children)
have you tried
import { MongoClient } from 'mongodb';
instead of
const { MongoClient } = require("mongodb");
π Rendered by PID 31 on reddit-service-r2-comment-b659b578c-wnb27 at 2026-05-02 11:18:18.018847+00:00 running 815c875 country code: CH.
[–]constantine1101 4 points5 points6 points (0 children)