-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
Use Case
As a... mongoose user
I want... to provide accurate information to BSON
So that... I can use encryption properly for numeric types
Acceptance Criteria
Implementation Requirements
- Create a schemaType subclass for Int32
- Pull in https://www.npmjs.com/package/mongoose-int32?activeTab=code
- Exception to the above package, we don't want to coerce doubles / decimal values to int32, throw instead
Testing Requirements
- Follow testing for existing schemaTypes
- Test that in the following cases the Int32 SchemaType throws
- Below INT32_MIN
- Above INT32_MAX
- decimal value
- invalid value (after numeric coercion)
- Integration tests
- When a model with an Int32 field is inserted, then the correct BSON type of Int32 is inserted for that field
- When promoteValues is not set / undefined / false and a document with an Int32 is fetched / find(), then a number is returned
- When promoteValues is set and a document with an Int32 is fetched / find(), then a BSON Int32 Type Class is returned
Documentation Requirements
- Add API documentation