Why is there no node.js documentation after version 4?

I used to use this documentation: Class: Collection (mongodb.github.io)

However, after version 4, there simply is no documentation. Why is this?

Documentation is well alive at MongoDB Node.js Driver

this, for example, is the 4.9 version of the one you linked:


Yes, I’ve found that page many times. That’s it then? It’s absolute garbage. It doesn’t provide any relevant information.

For example, if I want to find out what findOneAndUpdate returns, it doesn’t provide that information. “Returns Promise”. Yeah, thanks…

Nope, it is not garbage. it is an API documentation, not a how-to guide. this just shows you are not yet accustomed to using TypeScript or just do not know how to use API documentation.

Did you really say that?

open all findOneAndUpdate returns:
v2.2 Promise if no callback passed
v3.1 Promise if no callback passed
v3.7 Promise if no callback passed
v4.0 Promise<ModifyResult>
v4.9 Promise<ModifyResult>

over 6 years and 3 versions, the API doc has stayed almost the same except they started using TypeScript with v4.0.

The driver still has the same Javascript nature (with new and deprecated features) when used in a program.

It’s hot garbage. Look at the example I gave, which gave a list of options that you could send along, and what the method returns.

Now look at this stupid bullshit. It literally doesn’t give anything useful. Yes, I know it returns a Promise…

Case in point. Older docs:

value object Document returned from findAndModify command.
lastErrorObject object
The raw lastErrorObject returned from the command.
ok Number
Is 1 if the command executed correctly.

Oh look, it returns the document as value. Very useful! And it also shows how to get the new document instead of the old one.

The garbage you linked gives this information:

Yes, that’s right. Literally nothing.

Or you can just admit you don’t know how to read new documentation which is written with TypeScript.

TSchema, Filter, UpdateFilter, FindOneAndUpdateOptions, ModifyResult … these are all type names you would learn once and once needed.

They still imply the same things as before, just with an extra “type” layer.

I am, too, inclined to see old style but you cannot start a defamation campaign just because developers have chosen a more secure way for the project with the “type safety” of TypeScript. After, what we are talking about is still not a how-to guide, but an API documentation instead.

It’s not an API documentation, and TypeScript continues to be stupid. I don’t know how “TSchema” in itself conveys any information.

TSchema is just a model interface so you can have type check.

interface Movie { plot: string; title: string; }
const movies = database.collection<Movie>("movies");

But you don’t have to use TypeScript in your project. Because Typescript compiles to pure Javascript at the end (unless you use tsnode or deno) and in that case all you need is to use examples to write your queries. (change the version number on the left if you need)

Almost all examples are given in both TypeScript and Javascript.

The only problem here is that if you want to do more you will need to at least understand TypeScript (you don’t have to be pro for that, just know the basics). It is not a new language nor enforces you to use types all the time. It is just a “type” layer added on top of Javascript and helps to catch errors early during coding. Any Javascript file is a perfectly valid Typescript file.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.