Skip to content

Commit

Permalink
Rework text a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
n1mmy committed Feb 1, 2013
1 parent b013c57 commit fb3aafc
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions docs/client/concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,25 @@ <h2 id="dataandsecurity">Data and security</h2>
client *subscribes* to those sets. As documents in a set change, the
server patches each client's cache.

Documents are created, and the data inside them managed by, the
[`Meteor.Collection`](http://docs.meteor.com/#meteor_collection) class.
Meteor uses a subset of MongoDB, called
[minimongo](https://github.com/slacy/minimongo), so the syntax is very
similar.

// common code on client and server declares mongo collection
// (aka document)
Today most Meteor apps use MongoDB as their database because it is the
best supported, though support for other databases is coming in the
future. The
[`Meteor.Collection`](http://docs.meteor.com/#meteor_collection) class
is used to declare Mongo collections and to manipulate them. Thanks to
`minimongo`, Meteor's client-side Mongo emulator, `Meteor.Collection`
can be used from both client and server code.

// declare collections
// this code should be included in both the client and the server
Rooms = new Meteor.Collection("rooms");
Messages = new Meteor.Collection("messages");
Parties = new Meteor.Collection("parties");

// server: populate collections with some initial documents
Rooms.insert({name: "Conference Room A"});
var myRooms = Rooms.find({}).fetch();

Messages = new Meteor.Collection("messages");
Messages.insert({text: "Hello world", room: myRooms[0].id});

Parties = new Meteor.Collection("parties");
Parties.insert({name: "Super Bowl Party"});
Parties.insert({name: "Super Bowl Party"});

Each document set is defined by a publish function on the server. The
publish function runs each time a new client subscribes to a document
Expand Down

0 comments on commit fb3aafc

Please sign in to comment.