Collection of helper functions for mongo and mongoose database framework
- Source:
- Copyright:
- 5/7/19
Methods
(async, inner) calcDatabaseInfo()
- Source:
Helper function that generates an object with debug diagnostic info about mongoose/mongo database resource use
Returns:
object with diagnostic info
(async, inner) calcDatabaseStructure()
- Source:
Helper function that generates an object with debug diagnostic info about mongoose/mongo database
Returns:
object with diagnostic info
(inner) convertArrayOfObjectIdsToIdArray(objArray)
- Source:
- See:
We are passed an array of objects, with _id being a field of each object. We return an array of just the ids of each object
NOTES
This is probably a fancy js way to get these quickly
Parameters:
Name | Type | Description |
---|---|---|
objArray |
array |
(inner) isValidMongooseObjectId(str)
- Source:
- See:
-
- github issue ##### Notes * It may be unwise to use this strict a function, because if mongo id syntax changes it will fail. * This function is used to check if a certain string referes to a valid mongo id
Checks if a mongo/mongoose id is valid.
Parameters:
Name | Type | Description |
---|---|---|
str |
string |
Returns:
true if the passed str is a string and matches mongoose/mongo id format
(inner) OldUnusedMongoIdEqual(id1, id2)
- Source:
Check if two mongo object ids are identical, with support for ids being undefined/null.
Note
- returns false if EITHER id is undefined/null.
Parameters:
Name | Type | Description |
---|---|---|
id1 |
* | |
id2 |
* |
Returns:
true if they are equal mongo ids, and neither is null or undefined