Compare commits

..

No commits in common. "15dd706009a19e32a050b866b78661747938cda2" and "69672606fd3aada120109f413eb7c5be36d3e8ad" have entirely different histories.

2 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@navy.gif/wrappers", "name": "@navy.gif/wrappers",
"version": "1.7.7", "version": "1.7.6",
"description": "Various wrapper classes I use in my projects", "description": "Various wrapper classes I use in my projects",
"repository": "https://git.corgi.wtf/Navy.gif/wrappers.git", "repository": "https://git.corgi.wtf/Navy.gif/wrappers.git",
"author": "Navy.gif", "author": "Navy.gif",

View File

@ -194,7 +194,7 @@ class MongoDB
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof query._id === 'string' && query._id.length === 24) if (typeof query._id === 'string')
query._id = new ObjectId(query._id); query._id = new ObjectId(query._id);
this.#logger.debug(`Incoming find query for ${db} with parameters ${inspect(query)}`); this.#logger.debug(`Incoming find query for ${db} with parameters ${inspect(query)}`);
@ -222,7 +222,7 @@ class MongoDB
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof query._id === 'string' && query._id.length === 24) if (typeof query._id === 'string')
query._id = new ObjectId(query._id); query._id = new ObjectId(query._id);
this.#logger.debug(`Incoming findOne query for ${db} with parameters ${inspect(query)}`); this.#logger.debug(`Incoming findOne query for ${db} with parameters ${inspect(query)}`);
@ -250,7 +250,7 @@ class MongoDB
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (!filter) if (!filter)
throw new Error('Cannot run update many without a filter, if you mean to update every single document, pass an empty object'); throw new Error('Cannot run update many without a filter, if you mean to update every single document, pass an empty object');
if (typeof filter._id === 'string' && filter._id.length === 24) if (typeof filter._id === 'string')
filter._id = new ObjectId(filter._id); filter._id = new ObjectId(filter._id);
this.#logger.debug(`Incoming update query for '${db}' with parameters\n${inspect(filter)}\nand data\n${inspect(data)}`); this.#logger.debug(`Incoming update query for '${db}' with parameters\n${inspect(filter)}\nand data\n${inspect(data)}`);
@ -276,7 +276,7 @@ class MongoDB
throw new Error('MongoDB not connected'); throw new Error('MongoDB not connected');
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof filter._id === 'string' && filter._id.length === 24) if (typeof filter._id === 'string')
filter._id = new ObjectId(filter._id); filter._id = new ObjectId(filter._id);
this.#logger.debug(`Incoming updateOne query for ${db} with parameters ${inspect(filter)}`); this.#logger.debug(`Incoming updateOne query for ${db} with parameters ${inspect(filter)}`);
@ -302,7 +302,7 @@ class MongoDB
throw new Error('MongoDB not connected'); throw new Error('MongoDB not connected');
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof data._id === 'string' && data._id.length === 24) if (typeof data._id === 'string')
data._id = new ObjectId(data._id); data._id = new ObjectId(data._id);
this.#logger.debug(`Incoming insertOne query for ${db} with parameters ${inspect(data)}`); this.#logger.debug(`Incoming insertOne query for ${db} with parameters ${inspect(data)}`);
@ -319,7 +319,7 @@ class MongoDB
throw new Error('MongoDB not connected'); throw new Error('MongoDB not connected');
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof filter._id === 'string' && filter._id.length === 24) if (typeof filter._id === 'string')
filter._id = new ObjectId(filter._id); filter._id = new ObjectId(filter._id);
this.#logger.debug(`Incoming deleteOne query for ${db} with parameters ${inspect(filter)}`); this.#logger.debug(`Incoming deleteOne query for ${db} with parameters ${inspect(filter)}`);
@ -338,7 +338,7 @@ class MongoDB
throw new Error('MongoDB not connected'); throw new Error('MongoDB not connected');
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof filter._id === 'string' && filter._id.length === 24) if (typeof filter._id === 'string')
filter._id = new ObjectId(filter._id); filter._id = new ObjectId(filter._id);
const endTimer = MongoDB.#queryHistogram?.startTimer({ type: 'findOneAndDelete' }); const endTimer = MongoDB.#queryHistogram?.startTimer({ type: 'findOneAndDelete' });
@ -364,7 +364,7 @@ class MongoDB
throw new Error('MongoDB not connected'); throw new Error('MongoDB not connected');
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof filter._id === 'string' && filter._id.length === 24) if (typeof filter._id === 'string')
filter._id = new ObjectId(filter._id); filter._id = new ObjectId(filter._id);
this.#logger.debug(`Incoming push query for ${db}, with upsert ${upsert} and with parameters ${inspect(filter)} and data ${inspect(data)}`); this.#logger.debug(`Incoming push query for ${db}, with upsert ${upsert} and with parameters ${inspect(filter)} and data ${inspect(data)}`);
@ -390,7 +390,7 @@ class MongoDB
throw new Error('MongoDB not connected'); throw new Error('MongoDB not connected');
if (typeof db !== 'string') if (typeof db !== 'string')
throw new TypeError('Expecting collection name for the first argument'); throw new TypeError('Expecting collection name for the first argument');
if (typeof filter._id === 'string' && filter._id.length === 24) if (typeof filter._id === 'string')
filter._id = new ObjectId(filter._id); filter._id = new ObjectId(filter._id);
this.#logger.debug(`Incoming random query for ${db} with parameters ${inspect(filter)} and amount ${amount}`); this.#logger.debug(`Incoming random query for ${db} with parameters ${inspect(filter)} and amount ${amount}`);