mb-vqb-core
Advanced tools
Comparing version 0.5.5 to 0.5.6
@@ -8,11 +8,11 @@ "use strict"; | ||
var mongoUri = _a.mongoUri, collection = _a.collection, importsList = _a.importsList, refFunctionList = _a.refFunctionList, clause = _a.clause; | ||
return "var mongodb = require(\"mongodb\");\n" + (importsList.map(function (it) { return "var " + it + "=mongodb." + it + ";"; }).join("\n") + "\n") + "\n" + refFunctionList.join("\n") + "\n\nvar client = mongodb.MongoClient;\n\nclient.connect(" + JSON.stringify(mongoUri) + ", function (err, db) {\n \n var cursor = db.collection(" + JSON.stringify(collection) + ")" + clause + ";\n \n // Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\n cursor.toArray(function(err, result) {\n if (err) throw err;\n console.log(result);\n db.close();\n });\n});"; | ||
return "var mongodb = require(\"mongodb\");\n" + (importsList.map(function (it) { return "var " + it + "=mongodb." + it + ";"; }).join("\n") + "\n") + "\n" + refFunctionList.join("\n") + "\n\nvar client = mongodb.MongoClient;\n\nclient.connect(" + JSON.stringify(mongoUri) + ", function (err, db) {\n \n var cursor = db.collection(" + JSON.stringify(collection) + ")" + clause + ";\n \n // Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\n cursor.toArray(function(err, docs) {\n if (err) throw err;\n console.log(docs.map(function(it){return it._id}));\n db.close();\n });\n});"; | ||
}; | ||
var es6tmpl = function (_a) { | ||
var mongoUri = _a.mongoUri, collection = _a.collection, importsList = _a.importsList, refFunctionList = _a.refFunctionList, clause = _a.clause; | ||
return "const mongodb=require(\"mongodb\");\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nMongoClient.connect(" + JSON.stringify(mongoUri) + ").then((db)=> {\n return db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray()\n .then((docs)=>{\n console.log(docs);\n db.close();\n })\n }).catch(err=>{\n console.error(err);\n});"; | ||
return "const mongodb=require(\"mongodb\");\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nMongoClient.connect(" + JSON.stringify(mongoUri) + ").then((db)=> {\n return db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray()\n .then((docs)=>{\n console.log(docs.map(it=>it._id));\n db.close();\n })\n }).catch(err=>{\n console.error(err);\n});"; | ||
}; | ||
var es7tmpl = function (_a) { | ||
var mongoUri = _a.mongoUri, collection = _a.collection, importsList = _a.importsList, refFunctionList = _a.refFunctionList, clause = _a.clause; | ||
return "const mongodb=require(\"mongodb\");\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nasync function main(){\n const db=await MongoClient.connect(" + JSON.stringify(mongoUri) + ");\n const docs=await db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray();\n \n console.log(docs);\n\n db.close();\n}\n\nmain()"; | ||
return "const mongodb=require(\"mongodb\");\nconst {" + ["MongoClient"].concat(importsList).join(",") + "}=mongodb;\n\n" + refFunctionList.join("\n") + "\n\n// Created with MongoBoooter, the essential IDE for MongoDB - https://www.mongobooster.com\nasync function main(){\n const db=await MongoClient.connect(" + JSON.stringify(mongoUri) + ");\n const docs=await db.collection(" + JSON.stringify(collection) + ")" + clause + "\n .toArray();\n \n console.log(docs.map(it=>it._id));\n\n db.close();\n}\n\nmain()"; | ||
}; | ||
@@ -19,0 +19,0 @@ function nodejsStringify(_a) { |
{ | ||
"name": "mb-vqb-core", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "mb query core, internal project", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
127903