New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@salestrip/mongodb

Package Overview
Dependencies
Maintainers
6
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salestrip/mongodb - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

cf-generated-docker-compose-18mvajrzg.yaml

8

lib/db.module.js

@@ -81,5 +81,5 @@ 'use strict'

dbModule.findById = function(id, projection = {}) {
dbModule.findById = function(id, options = {}) {
return collection()
.findOne({_id: new ObjectId(id)}, projection)
.findOne({_id: new ObjectId(id)}, options)
.then((doc) => {

@@ -120,5 +120,5 @@ return doc ? deserialize(doc) : {}

dbModule.findOne = function(query, projection = {}) {
dbModule.findOne = function(query, options = {}) {
return collection()
.findOne(query, projection)
.findOne(query, options)
.then((doc) => {

@@ -125,0 +125,0 @@ return doc ? deserialize(doc) : {}

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "0.1.0",
"version": "0.1.1",
"main": "index.js",

@@ -9,0 +9,0 @@ "author": "SalesTrip Limited",

@@ -238,4 +238,6 @@ 'use strict'

const results = await db('projects').findById(id)
expect(results).not.toHaveProperty('_id')
expect(results.name).toBe(project1.name)
expect(results).toStrictEqual({
id: expect.any(String),
name: project1.name
})
})

@@ -251,2 +253,12 @@ })

})
it('accepts query options document', async () => {
const [project1, project2] = projects()
await this.collection.insertMany([project1, project2])
const options = {projection: {id: 1}}
const results = await db('projects').findById(project1._id, options)
expect(results).toStrictEqual({
id: expect.any(String)
})
})
})

@@ -379,6 +391,19 @@

})
expect(results).not.toHaveProperty('_id')
expect(results.name).toBe(project1.name)
expect(results).toStrictEqual({
id: expect.any(String),
name: project1.name
})
})
it('accepts query options document', async () => {
const [project1, project2] = projects()
await this.collection.insertMany([project1, project2])
const query = {name: project1.name}
const options = {projection: {id: 1}}
const results = await db('projects').findOne(query, options)
expect(results).toStrictEqual({
id: expect.any(String)
})
})
it('returns null object', async () => {

@@ -385,0 +410,0 @@ const results = await db('projects').findOne({name: 'whatever'})

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