Why two remove reference item are there for Model.remove in Mongoose API docs?

After landing into the API docs of mongoose, there is left side menu, Under model.js section. We see something like this:

- model.js

    -Model
    -save
    -increment
    -remove      <== 1
    -model
    -$where
    -ensureIndexes
    -remove      <== 2
    ...

Both remove are having the link to Model#remove([fn])

There is one more topic which is not linked. Titled Model.remove(conditions, [callback]) which is documented under the same model.js section. (just after the topic Model.ensureIndexes)

Could anyone one tell me what is the difference between both?

Answers


You can always browse the source code for mongoose. It's a great way to learn how it works.

There are two removes:

  1. Model.prototype.remove => this removes a specific mongoose Model object from a collection. It works on an instance.

    Model.prototype.remove = function remove (fn) { ... }

  2. Model.remove => this bypasses the Mongoose library and uses conditions supplied as the first parameter to perform a remove:

    Model.remove = function remove (conditions, callback) { ... }

(It is documented on the page as Model.remove, but it appears there's something wrong with the anchors on the page are pointed to the wrong function, likely because of the duplicated name.)


Need Your Help

What approach should one take to implement onboading in a web application?

javascript user-experience

I want to build onboarding in to my web app. See the attached image for an example. I would like to be more specific, but I am not sure what approach to take.

SSL Step Wise Beginners Implementation Guide

php ssl wamp implementation

I have a fair idea of SSL after a reading from a few places. But from where can a self learned PHP developer learn how to implememnt SSL - IS THERE A STEP WISE GUIDE ?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.