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.58 to 0.0.59

57

js/src/XMongoClient.js

@@ -72,10 +72,36 @@ "use strict";

model(collection, model) {
const connection = this.collection(collection);
if (model) {
model.native = function () {
return connection;
};
return model;
try {
const connection = this.collection(collection);
if (model) {
model.native = function () {
return connection;
};
return model;
}
else {
/**
* Extend XMongoModel
*/
return class extends XMongoModel {
/**
* Use `.native()` instead
* @deprecated since (v 0.0.40)
* @remove at (v 1.0.0)
*/
static thisCollection() {
console.error('Model.thisCollection() is deprecated, use .native() instead.');
return connection;
}
;
/**
* Returns native mongodb instance to run native queries
*/
static native() {
return connection;
}
;
};
}
}
else {
catch (e) {
/**

@@ -85,19 +111,2 @@ * Extend XMongoModel

return class extends XMongoModel {
/**
* Use `.native()` instead
* @deprecated since (v 0.0.40)
* @remove at (v 1.0.0)
*/
static thisCollection() {
console.error('Model.thisCollection() is deprecated, use .native() instead.');
return connection;
}
;
/**
* Returns native mongodb instance to run native queries
*/
static native() {
return connection;
}
;
};

@@ -104,0 +113,0 @@ }

{
"name": "xpress-mongo",
"version": "0.0.58",
"version": "0.0.59",
"description": "Light Weight ODM for mongoDb",

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

@@ -91,34 +91,39 @@ import XMongoModel = require('./XMongoModel');

model(collection: string, model?: typeof XMongoModel): typeof XMongoModel {
const connection: Collection = this.collection(collection);
try {
const connection: Collection = this.collection(collection);
if (model) {
model.native = function (): Collection {
return connection
if (model) {
model.native = function (): Collection {
return connection
}
return model;
} else {
/**
* Extend XMongoModel
*/
return <typeof XMongoModel><unknown>class extends XMongoModel {
/**
* Use `.native()` instead
* @deprecated since (v 0.0.40)
* @remove at (v 1.0.0)
*/
static thisCollection(): Collection {
console.error('Model.thisCollection() is deprecated, use .native() instead.')
return connection;
};
/**
* Returns native mongodb instance to run native queries
*/
static native(): Collection {
return connection;
};
}
}
return model;
} else {
} catch (e) {
/**
* Extend XMongoModel
*/
return <typeof XMongoModel><unknown>class extends XMongoModel {
/**
* Use `.native()` instead
* @deprecated since (v 0.0.40)
* @remove at (v 1.0.0)
*/
static thisCollection(): Collection {
console.error('Model.thisCollection() is deprecated, use .native() instead.')
return connection;
};
/**
* Returns native mongodb instance to run native queries
*/
static native(): Collection {
return connection;
};
}
return <typeof XMongoModel><unknown>class extends XMongoModel {}
}
}

@@ -125,0 +130,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