Mongoose: the function “once”


In the "Getting Started" of Mongoose (<a href="http://mongoosejs.com/docs/index.html" rel="nofollow">http://mongoosejs.com/docs/index.html</a>) there is an example that use the function once:

db.once('open', function callback () { // yay! });

but in the official documentation I don't find any reference to function once (<a href="http://mongoosejs.com/docs/api.html" rel="nofollow">http://mongoosejs.com/docs/api.html</a>).

What is the meaning of this function?


A Mongoose connection is an instance of <a href="http://nodejs.org/api/events.html#events_class_events_eventemitter" rel="nofollow">EventEmitter class</a>. From the documentation:


Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.



  • If statements without brackets
  • In shoes, how do I dock a stack to the bottom of the window?
  • How to get a class from a string in TypeScript/JavaScript in an Angular 2 application?
  • Mongoose TypeError: Cannot use 'in' operator to search for '_id' in [object Obje
  • MongoDB: \\lib\\server.js:235 process.nextTick getaddrinfo ENOTFOUND error
  • getting bad request while using passport in login form
  • RVM, Ruby 1.9.2, Rails 3, Passenger 3.0.2 (Bundler::GemNotFound)
  • What is the official release update URL for Aptana Studio 3.0?
  • Why is my req.body always empty on POST?
  • pythonanywhere - How do I use websockets to transmit messages as per the web2py messaging example?
  • What does certain JVM do after loading ByteCode into memory?
  • Wrapping a c#/WPF GUI around c++/cli around native c++
  • How can i dump blob fields from mysql tables
  • How can I replace the server in Web Component Tester
  • Defined variables not working in javascript files when I use getScript
  • Can't remove headers after they are sent
  • Clear activity stack before launching another activity
  • How to synchronize jQuery dialog box to act like alert() of Javascript
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • How can I extract results of aggregate queries in slick?
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • Record samples being played with OpenAL
  • MongoDB in PHP using aggregate to group by _id is null not working
  • Java applet as stand-alone Windows application?
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Can I make an Android app that runs a web view in Chrome 39?
  • Jquery - Jquery Wysiwyg return html as a string
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • SQL merge duplicate rows and join values that are different
  • Turn off referential integrity in Derby? is it possible?
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster
  • JaxB to read class hierarchy
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?