Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

moltyjs

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moltyjs - npm Package Compare versions

Comparing version 0.9.5 to 0.9.6

267

CHANGELOG.md
## [Unreleased]
* Wrap results docs in moltyClass but not remove the metadata provided by MongoDB
* Fix english misspelling in the documentation.
* Add embedded documents features
* Add query operations ([mquery](https://github.com/aheckmann/mquery) query builder))
* Add more cursor options ([MongoDB Doc](https://docs.mongodb.com/manual/reference/method/js-cursor/)).
* .batchSize(5) // Set batchSize on cursor to 5
* .filter({a:1}) // Set query on the cursor
* .addCursorFlag('oplogReplay', true) // Set cursor as oplogReplay
* .addCursorFlag('noCursorTimeout', true) // Set cursor as noCursorTimeout
* .addCursorFlag('awaitData', true) // Set cursor as awaitData
* .addCursorFlag('exhaust', true) // Set cursor as exhaust
* .addQueryModifier('$orderby', {a:1}) // Set $orderby {a:1}
* .maxScan(10) // Set the cursor maxScan
* .setCursorOption(field, value) // Set a node.js specific cursor option
* .showRecordId(true) // Set the cursor showRecordId
* .stream(options) // Return a modified Readable stream including a possible transform method.
- Wrap results docs in moltyClass but not remove the metadata provided by MongoDB
- Fix english misspelling in the documentation.
- Add embedded documents features
- Add query operations ([mquery](https://github.com/aheckmann/mquery) query builder))
- Add more cursor options ([MongoDB Doc](https://docs.mongodb.com/manual/reference/method/js-cursor/)).
- .batchSize(5) // Set batchSize on cursor to 5
- .filter({a:1}) // Set query on the cursor
- .addCursorFlag('oplogReplay', true) // Set cursor as oplogReplay
- .addCursorFlag('noCursorTimeout', true) // Set cursor as noCursorTimeout
- .addCursorFlag('awaitData', true) // Set cursor as awaitData
- .addCursorFlag('exhaust', true) // Set cursor as exhaust
- .addQueryModifier('$orderby', {a:1}) // Set $orderby {a:1}
- .maxScan(10) // Set the cursor maxScan
- .setCursorOption(field, value) // Set a node.js specific cursor option
- .showRecordId(true) // Set the cursor showRecordId
- .stream(options) // Return a modified Readable stream including a possible transform method.
## [0.9.6] - 2018-06-03
### Added
- Support for more than two level deep in nested schema objects
## [0.9.5] - 2018-05-20

@@ -24,3 +30,3 @@

* Mixes Schema type
- Mixes Schema type

@@ -31,3 +37,3 @@ ## [0.9.4] - 2018-05-17

* New agregate pipeline stages: sort, limit, skip, sortByCount
- New agregate pipeline stages: sort, limit, skip, sortByCount

@@ -38,3 +44,3 @@ ## [0.9.3] - 2018-05-17

* New cursor options to find() method: sort, skip, hint, explain, snapshot, timeout, tailable, returnKey, maxScan, min, max, showDiskLoc, comment, raw, promoteLongs, promoteValues, promoteBuffers, readPreference, partial, maxTimeMS, collation.
- New cursor options to find() method: sort, skip, hint, explain, snapshot, timeout, tailable, returnKey, maxScan, min, max, showDiskLoc, comment, raw, promoteLongs, promoteValues, promoteBuffers, readPreference, partial, maxTimeMS, collation.

@@ -45,3 +51,3 @@ ## [0.9.2] - 2018-04-08

* Bug on schema fields of array of Id refs, only assigned the las id of the array instead the entire array (refactor)
- Bug on schema fields of array of Id refs, only assigned the las id of the array instead the entire array (refactor)

@@ -52,3 +58,3 @@ ## [0.9.1] - 2018-04-08

* Bug on schema fields of array of Id refs, only assigned the las id of the array instead the entire array
- Bug on schema fields of array of Id refs, only assigned the las id of the array instead the entire array

@@ -59,7 +65,7 @@ ## [0.9.0] - 2018-03-09

* updateMany() method
- updateMany() method
### Changed
* Hooks names: 'insertOne', 'insertMany', 'updateOne', 'updateMany', 'deleteOne',
- Hooks names: 'insertOne', 'insertMany', 'updateOne', 'updateMany', 'deleteOne',

@@ -70,3 +76,3 @@ ## [0.8.11] - 2018-02-22

* Bug when timestamps equal true in schema definition didn't update the 'updatedAt' field on update() method
- Bug when timestamps equal true in schema definition didn't update the 'updatedAt' field on update() method

@@ -77,3 +83,3 @@ ## [0.8.8] - 2018-02-19

* Native MongoDB methods options were merged with MoltyJS options
- Native MongoDB methods options were merged with MoltyJS options

@@ -84,3 +90,3 @@ ## [0.8.7] - 2018-02-09

* Bug in the index mapping of Elasticsearch
- Bug in the index mapping of Elasticsearch

@@ -91,3 +97,3 @@ ## [0.8.6] - 2018-02-09

* Exposing API public to manage the Elasticseach (drop, search)
- Exposing API public to manage the Elasticseach (drop, search)

@@ -98,3 +104,3 @@ ## [0.8.5] - 2018-02-02

* New aggregation pipeline stages ($count, $group, $addFields, $redact)
- New aggregation pipeline stages ($count, $group, $addFields, $redact)

@@ -105,13 +111,13 @@ ## [0.8.4] - 2018-01-28

* Normalization of Mongo Ids
* New aggregation pipeline stages ( $replaceRoot, $facet, $unwind, $group)
- Normalization of Mongo Ids
- New aggregation pipeline stages ( $replaceRoot, $facet, $unwind, $group)
### Removed
* Validation on update Documents
- Validation on update Documents
### Fixed
* Bug validating empty (null) values
* Bug validating enum array values
- Bug validating empty (null) values
- Bug validating enum array values

@@ -122,11 +128,11 @@ ## [0.8.3] - 2018-01-23

* Support for multiple join conditions with $lookup operator in the aggregate() method
- Support for multiple join conditions with $lookup operator in the aggregate() method
### Changed
* Validation payload method on updated() action, now is used the same from the Model itself.
- Validation payload method on updated() action, now is used the same from the Model itself.
### Fixed
* Bug in aggregate() method for discriminated models
- Bug in aggregate() method for discriminated models

@@ -137,3 +143,3 @@ ## [0.8.2] - 2018-01-22

* Bugs in validation Schema field names (Document payload)
- Bugs in validation Schema field names (Document payload)

@@ -144,3 +150,3 @@ ## [0.8.1] - 2018-01-12

* Bugs in normalization and validation type methods (Document payload)
- Bugs in normalization and validation type methods (Document payload)

@@ -151,4 +157,4 @@ ## [0.8.0] - 2018-01-12

* Support for a better scheme field layout:
* ````javascript
- Support for a better scheme field layout:
- ````javascript
{

@@ -218,16 +224,16 @@ nested: {

* MoltyJS now supports Elasticsearch integration! :)
* deleteOne() method is available to perform documents deletions
* new 'delete' hook is available
- MoltyJS now supports Elasticsearch integration! :)
- deleteOne() method is available to perform documents deletions
- new 'delete' hook is available
### Changed
* Schema methods now don't pass neither the 'tenant' name or the 'connection' instance
* validate property Schema field now don't pass neither the 'tenant' name or the 'connection' instance
* 'tenant' is not required in 'new Document()' anymore
* 'tenant' now is required in 'insertOne()' and in 'insertMany()'
- Schema methods now don't pass neither the 'tenant' name or the 'connection' instance
- validate property Schema field now don't pass neither the 'tenant' name or the 'connection' instance
- 'tenant' is not required in 'new Document()' anymore
- 'tenant' now is required in 'insertOne()' and in 'insertMany()'
### Fixed
* Now Schemas, Models and Documents are not copied but cloned.
- Now Schemas, Models and Documents are not copied but cloned.

@@ -238,4 +244,4 @@ ## [0.6.2] - 2018-01-03

* Now is possible to have Mongo ObjectId type field in the Schema without refferencing any model.
* Improoved way of validating payload on schemas and payloads
- Now is possible to have Mongo ObjectId type field in the Schema without refferencing any model.
- Improoved way of validating payload on schemas and payloads

@@ -246,3 +252,3 @@ ## [0.6.1] - 2018-01-03

* Order in the documentation
- Order in the documentation

@@ -253,8 +259,8 @@ ## [0.6.0] - 2018-01-02

* aggregate() function with support for $match, $project, and $lookup (without recursivity) stages pipeline
* Documentation about new aggreagte() function
- aggregate() function with support for $match, $project, and $lookup (without recursivity) stages pipeline
- Documentation about new aggreagte() function
### Fixed
* Error that cause wrong merging og prehooks, posthooks and methods of discriminated models.
- Error that cause wrong merging og prehooks, posthooks and methods of discriminated models.

@@ -265,3 +271,3 @@ ## [0.5.1] - 2017-12-28

* Validation Schema function fields for nested objects.
- Validation Schema function fields for nested objects.

@@ -272,8 +278,8 @@ ## [0.5.0] - 2017-12-27

* Document constructor now return a Promise due the validation function on the Schema fields which can be async functions. The validation checking is done at the moment you create the Document.
* Passed the entire data payload normalized to the validate function instead of the value of the field is validating. In case further checking are neccesary.
* Documentaion about:
* Create a new Document
* Schema option fields
* Promise functions
- Document constructor now return a Promise due the validation function on the Schema fields which can be async functions. The validation checking is done at the moment you create the Document.
- Passed the entire data payload normalized to the validate function instead of the value of the field is validating. In case further checking are neccesary.
- Documentaion about:
- Create a new Document
- Schema option fields
- Promise functions

@@ -284,3 +290,3 @@ ## [0.4.3] - 2017-12-27

* Added support for async functions in the Schema fields validation function.
- Added support for async functions in the Schema fields validation function.

@@ -291,4 +297,4 @@ ## [0.4.2] - 2017-12-27

* Documentation about static methods, parameters 'connection' and 'tenant' were missing.
* Order of Schema fields validate function.
- Documentation about static methods, parameters 'connection' and 'tenant' were missing.
- Order of Schema fields validate function.

@@ -299,3 +305,3 @@ ## [0.4.1] - 2017-12-27

* tenant param from insertOne() and insertMany() since is not needed anumore because is already attached to the Document object
- tenant param from insertOne() and insertMany() since is not needed anumore because is already attached to the Document object

@@ -306,16 +312,16 @@ ## [0.4.0] - 2017-12-27

* Binded tenant and mongo client to the validate function in the Schema class, static methods and hooks in order to being able to perform querys directly to the DB from there.
* Added documentation about:
* Document creation
* Hooks
* Static Method
* Schema field validation
- Binded tenant and mongo client to the validate function in the Schema class, static methods and hooks in order to being able to perform querys directly to the DB from there.
- Added documentation about:
- Document creation
- Hooks
- Static Method
- Schema field validation
### Changed
* Documentation about Schema field properties
- Documentation about Schema field properties
### Fixed
* Example insertMany in the documentation
- Example insertMany in the documentation

@@ -326,15 +332,15 @@ ## [0.3.0] - 2017-12-21

* New method insertMany()
* New hook for insert many ('insertMany') where this is refered to the Documents Array
* Option parameter to inserOne() and to insertMany()
* 'moltyClass' option to findOne()
* Documentation about changes on insertOne(), insertMany() and hooks.
- New method insertMany()
- New hook for insert many ('insertMany') where this is refered to the Documents Array
- Option parameter to inserOne() and to insertMany()
- 'moltyClass' option to findOne()
- Documentation about changes on insertOne(), insertMany() and hooks.
### Removed
* Hooks from Document instances and keep it just in Model instances
- Hooks from Document instances and keep it just in Model instances
### Changed
* 'insert' hook is now called 'inserOne'
- 'insert' hook is now called 'inserOne'

@@ -345,7 +351,7 @@ ## [0.2.1] - 2017-12-20

* Options 'projection' to just exclude or include specific field in the documents results
- Options 'projection' to just exclude or include specific field in the documents results
### Changed
* Documentation about find() method
- Documentation about find() method

@@ -356,15 +362,15 @@ ## [0.2.0] - 2017-12-18

* Options 'limit' to limit the results with the find() function
* Options 'moltyClass' to wrap the result on Molty Document class instead of MongoDB Document class
* Info abot the find() function and its options
- Options 'limit' to limit the results with the find() function
- Options 'moltyClass' to wrap the result on Molty Document class instead of MongoDB Document class
- Info abot the find() function and its options
### Changed
* findOne() by find(). findOne() is already deprecated on MongoDB Native Driver
* Added Cursor support options to 'limit' on find()
* Unit test suites
- findOne() by find(). findOne() is already deprecated on MongoDB Native Driver
- Added Cursor support options to 'limit' on find()
- Unit test suites
### Fixed
* Fix documentation style glitches
- Fix documentation style glitches

@@ -375,9 +381,9 @@ ## [0.1.6] - 2017-12-18

* CHANGELOG
* Improoved documentation: Added advise about using the library in production environments.
* Added options behaviours for tenants (noListener, returnNonCachedInstance) [MongoDB Native Driver API](http://mongodb.github.io/node-mongodb-native/2.0/api/Db.html#db)
- CHANGELOG
- Improoved documentation: Added advise about using the library in production environments.
- Added options behaviours for tenants (noListener, returnNonCachedInstance) [MongoDB Native Driver API](http://mongodb.github.io/node-mongodb-native/2.0/api/Db.html#db)
### Changed
* Documet methods are now binded to the entire document not only to the payload data.
- Documet methods are now binded to the entire document not only to the payload data.

@@ -388,12 +394,12 @@ ## [0.1.5] - 2017-12-17

* Standarized handler for discriminated documents.
* Improoved documentation:
* Schema field properties.
* Create a new Model.
* Hooks middlewares.
* CRUD Operations
- Standarized handler for discriminated documents.
- Improoved documentation:
- Schema field properties.
- Create a new Model.
- Hooks middlewares.
- CRUD Operations
### Changed
* Unit testing suites: Models, Discriminators, Hooks, References.
- Unit testing suites: Models, Discriminators, Hooks, References.

@@ -404,7 +410,7 @@ ## [0.1.4] - 2017-12-16

* Saving and recovering functions documentation.
- Saving and recovering functions documentation.
### Fixed
* Bad initialization on dropped databases.
- Bad initialization on dropped databases.

@@ -415,7 +421,7 @@ ## [0.1.3] - 2017-12-16

* Improoved MongoClient with a better Model handler.
- Improoved MongoClient with a better Model handler.
### Changed
* Unit testing suites: CRUD Operations, Discriminators, Indexes.
- Unit testing suites: CRUD Operations, Discriminators, Indexes.

@@ -426,10 +432,10 @@ ## [0.1.2] - 2017-12-16

* Improoved documentation:
* Create a new Documet.
* Create a new Model.
- Improoved documentation:
- Create a new Documet.
- Create a new Model.
### Changed
* Model creation moved to Model constructor class.
* Unit testing suites: Models, Discriminators, Hooks, References.
- Model creation moved to Model constructor class.
- Unit testing suites: Models, Discriminators, Hooks, References.

@@ -440,3 +446,3 @@ ## [0.1.1] - 2017-12-16

* Referencing documents to the documentation.
- Referencing documents to the documentation.

@@ -447,6 +453,6 @@ ## [0.1.0] - 2017-12-16

* updateOne() method.
* Improoved Mongo ObjectID validation.
* Payload validation updating documents.
* Binded hooks to the document on 'save' middleware and to the query on 'update'
- updateOne() method.
- Improoved Mongo ObjectID validation.
- Payload validation updating documents.
- Binded hooks to the document on 'save' middleware and to the query on 'update'

@@ -457,7 +463,7 @@ ## [0.0.9] - 2017-12-14

* Model documentation.
- Model documentation.
### Fixed
* Unit testing suites for CRUD Operations, Discriminators, Hooks and Models.
- Unit testing suites for CRUD Operations, Discriminators, Hooks and Models.

@@ -468,3 +474,3 @@ ## [0.0.8] - 2017-12-14

* Print log on each connection created.
- Print log on each connection created.

@@ -475,3 +481,3 @@ ## [0.0.7] - 2017-12-14

* Unit testing suites.
- Unit testing suites.

@@ -482,3 +488,3 @@ ## [0.0.6] - 2017-12-14

* Schema documentation
- Schema documentation

@@ -489,3 +495,3 @@ ## [0.0.5] - 2017-12-14

* Improoved properties field validation on the schema creation proccess.
- Improoved properties field validation on the schema creation proccess.

@@ -496,3 +502,3 @@ ## [0.0.4] - 2017-12-14

* maxlength property to schema fields.
- maxlength property to schema fields.

@@ -503,3 +509,3 @@ ## [0.0.3] - 2017-12-14

* regeneratorRuntime transpiling error (babel).
- regeneratorRuntime transpiling error (babel).

@@ -510,5 +516,6 @@ ## 0.0.2 - 2017-12-14

* findOne() method.
* Document inheritence support.
- findOne() method.
- Document inheritence support.
[0.9.6]: https://github.com/Yonirt/moltyjs/compare/v0.9.5...v0.9.6
[0.9.5]: https://github.com/Yonirt/moltyjs/compare/v0.9.4...v0.9.5

@@ -560,9 +567,9 @@ [0.9.4]: https://github.com/Yonirt/moltyjs/compare/v0.9.3...v0.9.4

* **Added** for new features.
* **Changed** for changes in existing functionality.
* **Deprecated** for soon-to-be removed features.
* **Removed** for now removed features.
* **Fixed** for any bug fixes.
* **Security** in case of vulnerabilities.
- **Added** for new features.
- **Changed** for changes in existing functionality.
- **Deprecated** for soon-to-be removed features.
- **Removed** for now removed features.
- **Fixed** for any bug fixes.
- **Security** in case of vulnerabilities.
_This CHANGELOG is following a better changelog convention from [keepachangelog.com (Olivier Lacan)](http://keepachangelog.com/en/1.0.0/) project._

@@ -228,3 +228,3 @@ 'use strict';

*/
validatePayloadFieldValues(payload, schema, parentPayload, operator = null) {
validatePayloadFieldValues(payload = {}, schema, parentPayload) {
var _this2 = this;

@@ -252,3 +252,3 @@

try {
yield _this2.validatePayloadFieldValues(arrayItem, schema[key][0], parentPayload, operator);
yield _this2.validatePayloadFieldValues(arrayItem, schema[key][0], parentPayload);
continue;

@@ -276,5 +276,5 @@ } catch (error) {

// Objects nested
if (!schema[key].type && isObject(schema[key]) && !isArray(schema[key]) && payload[key]) {
if (!schema[key].type && isObject(schema[key]) && !isArray(schema[key])) {
try {
yield _this2.validatePayloadFieldValues(payload[key], schema[key], parentPayload, operator);
yield _this2.validatePayloadFieldValues(payload[key], schema[key], parentPayload);
continue;

@@ -287,7 +287,4 @@ } catch (error) {

// No required values
if ((!payload || payload[key] === undefined) && (!schema[key].required || operator)) continue;
// Is required validation
if ((!operator || operator === '$unset') && schema[key].required && (!payload || isEmptyValue(payload[key]))) {
throw new Error('Key ' + key + ' is required');
if (!payload || payload[key] === undefined || isEmptyValue(payload[key])) {
if (!schema[key].required) continue;else throw new Error('Key "' + key + '" is required');
}

@@ -414,3 +411,3 @@

// Objects nested
if (!schema[key].type && isObject(schema[key]) && !isArray(schema[key])) {
if (!schema[key].type && isObject(schema[key]) && !isArray(schema[key]) && payload && !isEmptyValue(payload[key])) {
const aux = this._normalizePayload(payload[key], schema[key]);

@@ -417,0 +414,0 @@ if (aux) payload[key] = aux;

{
"name": "moltyjs",
"version": "0.9.5",
"version": "0.9.6",
"description": "A tiny ODM for MongoDB with multy tenancy support.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc