-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should we deprecate this module since importing with npm:mongodb
is working well with Deno?
#380
Comments
I would love a hybrid version were we would use npm as a default but also webify the interfaces nodejs brings |
We can publish a new module on npm like mongodb-webified. It can benfites both worlds |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@steverandy please report it on fresh github repo. Thanks |
i prefer that it stays here. Else people could be thinking that it's not really made for Deno. |
I just tried the const client = new MongoClient(`mongodb://${user}:${pass}@${ip}:${port}/${dbName}`);
await client.connect();
db = client.db(dbName); Strange that it works sometimes. Seems premature to deprecate this unless I'm making some sort of weird mistake there, but that seems like a good idea in the long run - if only to have consistency of the API between Node and Deno. Edit: Just tested with |
You can follow the issues with mongoose/mongodb with deno here |
Well, since this issue is in question format, might as well give my 2 cents. It would be sad to see "native" deno mongo driver go, or fall into disrepair. Deno driver has the potential to be cleaner, prettier and faster, and the npm compatibility layer is big, complex and slow-ish to load. It seems to also be true that there is a lack of maintainers to keep working on the Deno driver. And that it needs nontrivial amount of work to be good enough for widespread production use. Since the userbase is small for now, and the node driver is usable already as-is, it may be unrewarding to work on the Deno driver. Maybe the best solution for now would be to put a big banner on the readme, with:
This way regular users would not be discouraged from using Deno because of frustrating problems with unstable drivers. And there would be hope for the project to gain maintainers in the future, or even some "official" support from Mongo, eventually improving the driver beyond the NPM driver :) |
@erfanium The compatibility is not quite there yet: denoland/deno#16633 |
This has supposedly been fixed in Deno 1.37! |
I jus tried on local an deploy and seems to be working with MongoDB Atlas serverless deno v1.37 import { MongoClient } from "npm:mongodb"
import { ulid } from "https://deno.land/[email protected]/ulid/mod.ts";
const client = new MongoClient("<url>")
client.connect();
Deno.serve(async () => {
const data = await client.db("deno").collection("deno").insertOne({
name: ulid()
})
return new Response(JSON.stringify({
data
}), {
headers: { "Content-Type": "application/json" },
})
}) |
Hey all, just wanted to chime in here as I'm the Product Manager at MongoDB for the Node.js driver, as well as the reporter of denoland/deno#16633 (which was addressed directly in the driver, as well as in the runtime via denoland/deno#20314). Ultimately the goal is to have an ideal, runtime agnostic driver that the community can use so if there are still issues with using the driver via Deno I'd love to hear them :) |
@alexbevi Would be cool if the Node.js driver would be Webified and uses modern standard. Same as what happened with BSON which is almost Node.js free which is awesome. My dream would be that the deno/nodejs driver could be the same code and only need to polyfill the Direct Sockets API :D (and maybe in the future not even that) |
Thanks for the feedback @lucsoft. We're currently evaluating the driver against Deno to see if there's anything that outright doesn't work (feel free to share if you're aware of features that don't work) |
@alexbevi Thanks for reaching out to us! As far as I know, MongoDB's official driver for Node.js only ships with CJS modules. So, you'd need to use Deno's npm compatibility layer to use the official driver. I'd love to see MongoDB's official driver shipped as a Deno-native package in the deno.land/x registry, just like this module. with no dependency to |
Chiming in with an update that the recommended Atlas-SDK leans on the Data API which is now deprecated and has (I think) one year of life left. I couldn't find any reasonably well working deno compatible drivers that would cooperate with Netlify Edge Functions (Deno Deploy), and they fail to bundle the npm:mongo driver, although it does work locally when testing with the Netlify CLI. |
We need to start to differentiate. if you use Atlas use the Atlas SDK. Atlas is not MongoDB, its Atlas. |
FWIW i was able to get the regular mongo driver working on Netlify edge functions by using an older version, without the dependency on the newer web-bson package. Version 0.31.1 worked for me, however the newer versions had a problem imported that dependency. |
Mongo Atlas deprecated Data API I guess by using Atlas for production you risk being forced into costly migration when they shut it down completely |
Also adding my 0.02, FWIW, I think deno has an opportunity to move into an Elixir like space for Typescript, and has already started down that road with std lib / jsr. I’d like to see first class std lib type support for the major DBs. |
It seems like the deno imported npm library for mongo does not support unix domain sockets - is this expected behaviour or an oversight? |
npm:mongodb
pros:cons:
requried --unstable flagit's not compatible with Deno Deploy for nowx/mongo
because uses node compat layerThe text was updated successfully, but these errors were encountered: