Compare commits
2 Commits
69672606fd
...
15dd706009
Author | SHA1 | Date | |
---|---|---|---|
15dd706009 | |||
ae41d56259 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@navy.gif/wrappers",
|
"name": "@navy.gif/wrappers",
|
||||||
"version": "1.7.6",
|
"version": "1.7.7",
|
||||||
"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",
|
||||||
|
@ -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')
|
if (typeof query._id === 'string' && query._id.length === 24)
|
||||||
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')
|
if (typeof query._id === 'string' && query._id.length === 24)
|
||||||
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')
|
if (typeof filter._id === 'string' && filter._id.length === 24)
|
||||||
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')
|
if (typeof filter._id === 'string' && filter._id.length === 24)
|
||||||
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')
|
if (typeof data._id === 'string' && data._id.length === 24)
|
||||||
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')
|
if (typeof filter._id === 'string' && filter._id.length === 24)
|
||||||
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')
|
if (typeof filter._id === 'string' && filter._id.length === 24)
|
||||||
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')
|
if (typeof filter._id === 'string' && filter._id.length === 24)
|
||||||
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')
|
if (typeof filter._id === 'string' && filter._id.length === 24)
|
||||||
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}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user