computation.invalidate

Client computation.invalidate() Source Invalidates this computation so that it will be rerun.

computation.firstRun

Client computation.firstRun Source True during the initial run of the computation at the time Tracker.autorun is called, and false on subsequent reruns and at other times.

Collections and Schemas

After reading this guide, you’ll know: The different types of MongoDB collections in Meteor, and how to use them. How to define a schema for a collection to control its content. What to consider when defining your collection’s schema. How to enforce the schema when writing to a collection. How to carefully change the schema of your collection. How to deal with associations between records. MongoDB collections in Meteor At its core, a web application offers its users a view into, and a way to

collection.upsert

Anywhere collection.upsert(selector, modifier, [options], [callback]) Source Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys numberAffected (the number of documents modified) and insertedId (the unique _id of the document that was inserted, if any). Arguments selector Mongo Selector, Object ID, or String Specifies which documents to modify modifier Mongo Modifier Specifies how to modify the documents

collection.update

Anywhere collection.update(selector, modifier, [options], [callback]) Source Modify one or more documents in the collection. Returns the number of affected documents. Arguments selector Mongo Selector, Object ID, or String Specifies which documents to modify modifier Mongo Modifier Specifies how to modify the documents callback Function Optional. If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.

collection.remove

Anywhere collection.remove(selector, [callback]) Source Remove documents from the collection Arguments selector Mongo Selector, Object ID, or String Specifies which documents to remove callback Function Optional. If present, called with an error object as its argument.

collection.rawDatabase

Server collection.rawDatabase() Source Returns the Db object corresponding to this collection's database connection from the npm mongodb driver module which is wrapped by Mongo.Collection.

collection.rawCollection

Server collection.rawCollection() Source Returns the Collection object corresponding to this collection from the npm mongodb driver module which is wrapped by Mongo.Collection.

collection.insert

Anywhere collection.insert(doc, [callback]) Source Insert a document in the collection. Returns its unique _id. Arguments doc Object The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you. callback Function Optional. If present, called with an error object as the first argument and, if no error, the _id as the second.

collection.findOne

Anywhere collection.findOne([selector], [options]) Source Finds the first document that matches the selector, as ordered by sort and skip options. Arguments selector Mongo Selector, Object ID, or String A query describing the documents to find Options sort Mongo Sort Specifier Sort order (default: natural order) skip Number Number of results to skip at the beginning fields Mongo Field Specifier Dictionary of fields to return or exclude. reactive Boolean (Client only