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

xpress-mongo

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xpress-mongo - npm Package Compare versions

Comparing version 0.0.29 to 0.0.30

14

js/src/XMongoModel.js

@@ -138,3 +138,3 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
const record = (new this()).set(data);
const record = this.make(data);
if (save)

@@ -146,2 +146,12 @@ yield record.save();

/**
* Creates instance.
* @desc
* Just like .new but unlike .new it does not save the record to the database it to the database
* @param data - new record data.
* @return {Promise<this|*>}
*/
static make(data) {
return (new this()).set(data);
}
/**
* Check if id is a valid id

@@ -571,3 +581,3 @@ * @param id

/**
* Turn data provided in query function to model instances.
* Use data provided to model instance.
* @param {{}} data

@@ -574,0 +584,0 @@ */

2

package.json
{
"name": "xpress-mongo",
"version": "0.0.29",
"version": "0.0.30",
"description": "Light Weight ODM for mongoDb",

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

@@ -185,9 +185,20 @@ import ObjectCollection = require('object-collection');

*/
static async new(data: StringToAnyObject, save = true): Promise<XMongoModel> {
const record = (new this()).set(data);
static async new<T extends XMongoModel>(data: StringToAnyObject, save = true): Promise<T> {
const record = this.make(data);
if (save) await record.save();
return record;
return <T>record;
}
/**
* Creates instance.
* @desc
* Just like .new but unlike .new it does not save the record to the database it to the database
* @param data - new record data.
* @return {Promise<this|*>}
*/
static make<T extends XMongoModel>(data: StringToAnyObject): T {
return <T>(new this()).set(data);
}
/**
* Check if id is a valid id

@@ -698,3 +709,3 @@ * @param id

/**
* Turn data provided in query function to model instances.
* Use data provided to model instance.
* @param {{}} data

@@ -701,0 +712,0 @@ */

@@ -96,4 +96,12 @@ import ObjectCollection = require('object-collection');

*/
static new(data: StringToAnyObject, save?: boolean): Promise<XMongoModel>;
static new<T extends XMongoModel>(data: StringToAnyObject, save?: boolean): Promise<T>;
/**
* Creates instance.
* @desc
* Just like .new but unlike .new it does not save the record to the database it to the database
* @param data - new record data.
* @return {Promise<this|*>}
*/
static make<T extends XMongoModel>(data: StringToAnyObject): T;
/**
* Check if id is a valid id

@@ -199,3 +207,3 @@ * @param id

/**
* Turn data provided in query function to model instances.
* Use data provided to model instance.
* @param {{}} data

@@ -202,0 +210,0 @@ */

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