Files
meteor/packages/mongo
Evan Broder f3f5e01ea8 Thread upstream mongodb types through npm-mongo
As it exists currently, the types for the mongo package don't work out
of the box because they can't find the types for the mongodb NPM
package. TypeScript app developers could work around this by adding
mongodb directly as a dependency, but they shouldn't have to.

However, `zodern:types` can handle pulling in types for NPM
dependencies, but only if the package _with_ those NPM dependencies is
itself exporting type declarations. Since npm-mongo is actually
depending on the mongodb package, add a type declaration reflecting both
the types and objects that it exports. Then switch the mongo package to
import from npm-mongo, giving it access to the types for the mongodb
package.
2023-02-09 13:37:30 -08:00
..
2014-08-28 11:14:40 -07:00
2022-07-26 13:48:08 +02:00
2023-02-07 17:13:47 -03:00
2022-09-07 11:09:12 +02: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.