Files
meteor/packages/mongo
Ben Newman 17eaa5bd6f Implement Mongo.Collection as a function again.
This reverts commit b06a6af335, where I
attempted to allow `Mongo.Collection` to be subclassed by non-native class
syntax by implementing static `call` and `apply` methods.

As the reproduction in #9595 demonstrates, in order to subclass
`Mongo.Collection` properly given this trick, one would need to override
not only the `constructor` method but also the `init` method that the
`Mongo.Collection` base class calls. Since this implicit expectation is
too much to ask of new subclassing code, let alone existing subclassing
code, I'm afraid the only remaining option is to go back to implementing
`Mongo.Collection` as a traditional constructor function, rather than
using native `class` syntax, so that subclasses can invoke the constructor
using `Function.prototype.{call,apply}` as they've always done.
2018-01-29 19:23:13 -05:00
..
2014-08-28 11:14:40 -07:00
2014-08-28 11:14:40 -07:00
2017-01-17 13:58:02 +03:00
2016-12-21 03:23:06 +03:00
2016-06-24 12:15:26 -04:00
2016-08-30 15:40:14 -07:00

mongo

Source code of released version | Source code of development version


The mongo package is a full stack database driver that provides several paramount pieces of functionality to work with MongoDB in Meteor:

  • an efficient Livequery implementation providing real-time updates from the database by consuming the MongoDB replication log
  • a fall-back Livequery implementation for cases when the replication log is not available, implemented by polling the database
  • DDP RPC end-points for updating the data from clients connected over the wire
  • Serialization and deserialization of updates to the DDP format

To learn more about Livequery, see the project page on www.meteor.com.

Direct access to npm mongodb API

On the server, the mongo package is implemented using the npm mongodb module. If you'd like direct access to this module, you can find it at MongoInternals.NpmModules.mongodb.module. Its version can be read at MongoInternals.NpmModules.mongodb.version.

Additionally, you can call c.rawCollection() or c.rawDatabase() on any Mongo.Collection to get the object from the npm mongodb module corresponding to the collection or database. This is documented at http://mongodb.github.io/node-mongodb-native/

The version of mongo used may change incompatibly from version to version of Meteor (or we may even replace it with an entirely different implementation); use at your own risk.