Comparing version 1.0.17 to 1.0.18
20
mongo.js
@@ -208,3 +208,3 @@ const MongoDB = require('mongodb'); | ||
function insert(client, cmd) { | ||
async function insert(client, cmd) { | ||
@@ -257,5 +257,7 @@ var builder = cmd.builder; | ||
if(gencode) { | ||
client.db(client.$database).collection(gencode.indexes).findOne({ code: gencode.precode }, function(err, response) { | ||
var db = DBMS(); | ||
var codegen = await db.one(gencode.indexes).where('code', gencode.precode).promise(); | ||
db.modify(gencode.indexes, { '+index': +1 } ).where('code', gencode.precode); | ||
var indexcode = response.index + 1; | ||
var indexcode = codegen.index + 1; | ||
indexcode = indexcode.toString(); | ||
@@ -267,3 +269,3 @@ while (indexcode.length < gencode.output) { | ||
params[gencode.key] = gencode.precode + indexcode; | ||
if(gensearch) { | ||
@@ -274,14 +276,10 @@ var one = gensearch.one; | ||
} | ||
} | ||
client.db(client.$database).collection(gencode.indexes).updateOne({ code: gencode.precode }, { $inc: { index: +1 } }); | ||
builder.db.$debug && builder.db.$debug(); | ||
}); | ||
} | ||
// builder.db.$debug && builder.db.$debug(); | ||
client.db(client.$database).collection(opt.table).insertOne(params, function(err, response) { | ||
client.close(); | ||
err && client.$opt.onerror && client.$opt.onerror(err, opt, builder); | ||
builder.$callback(params, err, response && response.result && response.result.n ? 1 : 0); | ||
builder.$callback(err, response && response.result && response.result.n ? 1 : 0); | ||
}); | ||
@@ -288,0 +286,0 @@ } |
{ | ||
"name": "icorm", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"description": "Database Management System", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
216828