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.1 to 0.2.0

cf-generated-docker-compose-eopppqqbg.yaml

3

lib/db.module.js

@@ -119,3 +119,4 @@ 'use strict'

dbModule.findOne = function(query, options = {}) {
dbModule.findOne = function({id, ...rest}, options = {}) {
const query = id ? {_id: new ObjectId(id), ...rest} : {...rest}
return collection()

@@ -122,0 +123,0 @@ .findOne(query, options)

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

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

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

@@ -406,2 +406,28 @@ 'use strict'

given('query contains string "id"', () => {
it('returns matching document', async () => {
const [project1, project2] = projects()
await this.collection.insertMany([project1, project2])
const id = project1._id.toHexString()
expect(typeof id).toBe('string')
const results = await db('projects').findOne({id})
expect(results).not.toHaveProperty('_id')
expect(results.name).toBe(project1.name)
})
})
given('query contains id as ObjectId', () => {
it('returns matching document', async () => {
const [project1, project2] = projects()
await this.collection.insertMany([project1, project2])
const id = project1._id
expect(id).toBeInstanceOf(db.ObjectId)
const results = await db('projects').findOne({id})
expect(results).toStrictEqual({
id: expect.any(String),
name: project1.name
})
})
})
it('returns null object', async () => {

@@ -408,0 +434,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