Git Product home page Git Product logo

Comments (3)

hwangm avatar hwangm commented on August 27, 2024

@kazzacarrot Here's my code if you want to compare - it passes run and verify. In the official MongoDB Node api notes, remove() has been deprecated in favor of deleteOne() or deleteMany().

var mongo = require('mongodb').MongoClient;

var url = 'mongodb://localhost:27017/'+process.argv[2];

mongo.connect(url, (err, db) => {
        if (err) throw err;
        var coll = db.collection(process.argv[3]);
        var id = process.argv[4];
        coll.deleteOne({
                _id: id
        }, (err, data) => {
                if (err) throw err;
                db.close();
        });
});

from learnyoumongo.

snehal96 avatar snehal96 commented on August 27, 2024

@hwangm, I copy pasted your code and it still shows the same error for me.













Expected document to be removed [ { _id: '554a655c0639034860349353', name: 'blah' } ]

Mongodb version:






MongoDB shell version v3.6.2
git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
OpenSSL version: OpenSSL 1.0.0-fips 29 Mar 2010
allocator: tcmalloc
modules: none
build environment:
distmod: amazon
distarch: x86_64
target_arch: x86_64

P.S.: I am using amazon clod 9 ide.

from learnyoumongo.

hwangm avatar hwangm commented on August 27, 2024

@snehal96 Have you looked at the solutions updated for mongodb 3+?
https://github.com/nachoperassi/learnyoumongo

Perhaps there was some change that makes my solution invalid now, I'm not sure since it was a while ago now.

from learnyoumongo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.