bajankristof / nedb-promises

A dead-simple promise wrapper for nedb.
MIT License
297 stars 45 forks source link

Calling Datastore#persistence#compactDatafile is deprecated #72

Open Gikkman opened 2 months ago

Gikkman commented 2 months ago

I moved over to using nedb-promises over plain nedb due to their Typescript types having issues. So far, it's been working great. The only thing I've noticed is that calling

database.persistance.compactDatafile()

will print a warning to the console with the following message:

(node:13872) DeprecationWarning: @seald-io/nedb: calling Datastore#persistence#compactDatafile is deprecated, please use Datastore#compactDatafile, it will be removed in the next major version.

This is due to @seald/nedb having marked calls going via .persistence as deprecated. Instead, they want us to call the functions straight on the database object. Like this:

database.compactDatafile()

The nedb-promises types file currently does not expose these functions. But there is a work-around in the mean time, to cast the object to any before making the call. So the method is there, it just isn't exposed.

(database as any).compactDatafile();
stale[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.