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

albatross

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

albatross - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

2

lib/albatross.js

@@ -22,3 +22,3 @@ const { GridStore, MongoClient, ObjectId } = require('mongodb')

if (this[kClient] == null) {
this[kClient] = MongoClient.connect(this[kURI], { useNewUrlParser: true, useUnifiedTopology: true })
this[kClient] = MongoClient.connect(this[kURI], { useNewUrlParser: true, useUnifiedTopology: true, ignoreUndefined: true })

@@ -25,0 +25,0 @@ try {

const debug = require('debug')
const { BSON } = require('bson')
const kDebug = Symbol('debug')
const bsonParser = new BSON()
function prepareDocument (document) {
return bsonParser.deserialize(bsonParser.serialize(document), { promoteValues: true })
}
class Collection {

@@ -49,3 +56,3 @@ constructor (parent, name) {

this[kDebug]('count(%o)', query)
const res = await db.collection(this.name).countDocuments(query, opts)
const res = await db.collection(this.name).countDocuments(query, { ignoreUndefined: true, ...opts })
this[kDebug]('reply OK')

@@ -98,3 +105,3 @@ return res

this[kDebug]('insertMany(%o)', docs)
const res = await db.collection(this.name).insertMany(docs, opts)
const res = await db.collection(this.name).insertMany(docs.map(prepareDocument), opts)
this[kDebug]('reply OK')

@@ -104,3 +111,3 @@ return res.ops

this[kDebug]('insertOne(%o)', docs)
const res = await db.collection(this.name).insertOne(docs, opts)
const res = await db.collection(this.name).insertOne(prepareDocument(docs), opts)
this[kDebug]('reply OK')

@@ -120,3 +127,3 @@ return res.ops[0]

this[kDebug]('findOneAndUpdate(%o, %o)', filter, update)
const res = await db.collection(this.name).findOneAndUpdate(filter, update, opts)
const res = await db.collection(this.name).findOneAndUpdate(filter, update, { ignoreUndefined: true, ...opts })
this[kDebug]('reply OK')

@@ -123,0 +130,0 @@ return res.value

{
"name": "albatross",
"version": "2.1.0",
"version": "3.0.0",
"license": "MIT",

@@ -17,6 +17,8 @@ "author": "Linus Unnebäck <linus@folkdatorn.se>",

"dependencies": {
"bson": "^1.1.1",
"debug": "^4.1.1",
"mongodb": "^3.4.0"
"mongodb": "^3.5.4"
},
"devDependencies": {
"@types/bson": "^1.0.11",
"@types/mocha": "^5.2.7",

@@ -23,0 +25,0 @@ "@types/mongodb": "^3.3.12",

@@ -57,2 +57,4 @@ # ![Albatross](/header.png?raw=true "Albatross")

**Note:** Albatross creates the MongoDB client with `ignoreUndefined: true`, which means that `undefined` values will not be stored in the database. This is the new default in the BSON library, and is also how the standard `JSON.stringify` works.
#### BSON Binary API

@@ -135,2 +137,4 @@

**Note:** Contrary to the standard MongoDB Node.js driver, this function will *not modify* any objects that are passed in. Instead, the returned documents from this function are what was saved in the database.
### `findOneAndUpdate(filter, update[, opts]): Promise<object>`

@@ -137,0 +141,0 @@

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