
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
@clocklimited/save-mongodb
Advanced tools
npm install @clocklimited/save-mongodb
// There is a peer dependency of mongodb - you have to bring your own!
npm install mongodb@^4
If you want to see how this works look at the tests or this simple example:
var MongoClient = require('mongodb').MongoClient // npm install mongodb
var save = require('save') // npm install save
var saveMongodb = require('@clocklimited/save-mongodb')
// connect to your mongodb database.
MongoClient.connect('mongodb://localhost:27017/', function(error, client) {
if (error) return console.error(error.message)
var connection = client.db('test')
// Get a collection. This will create the collection if it doesn't exist.
connection.collection('contact', function(error, collection) {
if (error) return console.error(error.message)
// Create a save object and pass in a mongodb engine.
var contactStore = save('Contact', { engine: saveMongodb(collection) })
// Then we can create a new object.
contactStore.create({ name: 'Paul', email: 'paul@serby.net' }, function(
error,
contact
) {
if (error) return console.error(error.message)
// The created 'contact' is returned and has been given an _id
console.log(contact)
// Don't forget to close your database connection!
client.close()
})
})
})
Find now has a streaming interface
var contactStore = save('Contact', { engine: saveMongodb(collection) })
var es = require('event-stream')
contactStore.find({})
.pipe(es.stringify())
.pipe(process.stdout)
Paul Serby follow me on twitter @serby Clock Limited follow us on twitter @clock
Licenced under the New BSD License
v4.0.0
mongodb
version 4. This comes with a minimum MongoDB server version of 3.6.idType
property was previously an instance of ObjectID
but is now ObjectId
. This is not a functional change, but you may experience issues if comparing types or using instanceof
.FAQs
mongodb persistence engine for save
The npm package @clocklimited/save-mongodb receives a total of 37 weekly downloads. As such, @clocklimited/save-mongodb popularity was classified as not popular.
We found that @clocklimited/save-mongodb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.