What is the –save option for npm install?

Update npm 5: As of npm 5.0.0, installed modules are added as a dependency by default, so the –save option is no longer needed. The other save options still exist and are listed in the documentation for npm install. Original answer: Before version 5, NPM simply installed a package under node_modules by default. When you … Read more

What’s the difference between tilde(~) and caret(^) in package.json?

See the NPM docs and semver docs: ~version “Approximately equivalent to version”, will update you to all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0. ^version “Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from … Read more

collection is not defined in mongodb

Here your not declared the variable(collection) so that only you got this error.You need to declare that variable with proper collection name. For Example : If you are going to find the records in users collection under test schema you need to the follow the below code. var express = require(‘express’); var router = express.Router(); … Read more

Unable to delete data from mongoDB

You need to pass the _id value as an ObjectID, not a string: var mongodb = require(‘mongodb’); router.delete(‘/contact/:id’, (req, res, next) => { contact.deleteOne({ _id: new mongodb.ObjectID(req.params._id) }, function(err, result) { if (err) { res.json(err); } else { res.json(result); } }); });

im new to making discord bots with node.js, i am having trouble with an error, it says that message is not defined in line 14 and 18

here,try this: client.on(‘message’, message =>{ if(message.content.startsWith(prefix) ||message.author.bot) return; const args = message.content.slice(prefix.lenght).split(/+/); const command = args.shift().toLowerCase(); if(command === ‘blackhumour’){ message.channel.send(‘What is the difference between a kid and a bowling ball? when you put your fingers in one it doesnt scream’); } else if(command === ‘sex’){ message.channel.send(‘no you fucking pervert’); } });