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

advaya-mongo

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

advaya-mongo - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

index.js

@@ -34,4 +34,4 @@ var db= require('./db');

connect: db.connect,
initialize: initialize
initialize: initialize(models)
}
}

@@ -1,5 +0,44 @@

module.exports= function () {
return new Promise(function (resolve,reject) {
resolve(1);
});
module.exports= function (models) {
return function () {
var db = require('./db').getDb();
return new Promise(function (resolve,reject) {
var indexPromiseArr= Object.keys(models)
.map(function (modelName) {
return models[modelName];
})
.filter(function (model) {
if(model.schema.hasOwnProperty('index') && Array.isArray(model.schema.index))
return true;
})
.map(function (model) {
if(model.schema.hasOwnProperty('embeded'))
{
var transformIndex= model.schema.index.map(function (index) {
var keyObj={}
Object.keys(index.key)
.map(function (key) {
keyObj[model.modelName+'.'+key]=index.key[key];
});
index.key= keyObj;
return index;
});
var idUnique={ key: { }, unique: true };
idUnique.key[model.modelName+'._id']=1;
transformIndex.push(idUnique);
// console.log(transformIndex);
return db.collection(model.schema.embeded).createIndexes(transformIndex);
}
else
{
return db.collection(model.modelName).createIndexes(model.schema.index);
}
})
resolve(Promise.all(indexPromiseArr));
});
}
}
{
"name": "advaya-mongo",
"version": "1.0.0",
"version": "1.0.1",
"description": "Advaya mongo plugin",

@@ -5,0 +5,0 @@ "main": "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