senter-mongo-repository
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -63,3 +63,3 @@ const MongoClient = require('mongodb').MongoClient; | ||
async search(searchTerm, limit = 1000) { | ||
async search(searchTerm, limit = 1000, projection = null) { | ||
if (!searchTerm) { | ||
@@ -72,4 +72,10 @@ throw Error("Mongo repository: search error: searchTerm cannot be null or empty"); | ||
let docs = await this._collection.find(searchTerm).limit(limit).toArray(); | ||
var query = this._collection.find(searchTerm).limit(limit); | ||
if (projection) | ||
{ | ||
query = query.project(projection); | ||
} | ||
let docs = await query.toArray(); | ||
docs.forEach(x => { | ||
@@ -76,0 +82,0 @@ x.id = x._id; |
{ | ||
"name": "senter-mongo-repository", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Contain methods to work with mongo db", | ||
@@ -5,0 +5,0 @@ "main": "mongoReposotory.js", |
@@ -5,3 +5,3 @@ const MongoRepository = require("../mongoReposotory"); | ||
const connectionString = 'mongodb+srv://sandbox:MLiGyVdt97ECQSbO876hPtGExk36sp15@sandbox-5zqkh.mongodb.net/test?retryWrites=true&w=majority'; | ||
const connectionString = ''; | ||
const dbName = 'senter'; | ||
@@ -8,0 +8,0 @@ const collectionName = MongoRepository.ContactListsCollectionName; |
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
18666
505