mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Greenspan comments on ddp-pre1 diff
This commit is contained in:
@@ -953,10 +953,9 @@ order of the documents in the result set. They are more efficient than
|
||||
Before `observe` returns, `added` (or `addedAt`) will be called zero
|
||||
or more times to deliver the initial results of the query.
|
||||
|
||||
`observe` returns a live query handle, which is an object with a
|
||||
`stop` method. Call this function with no arguments to stop calling
|
||||
the callback functions and tear down the query. **The query will run
|
||||
forever until you call this.**
|
||||
`observe` returns a live query handle, which is an object with a `stop` method.
|
||||
Call `stop` with no arguments to stop calling the callback functions and tear
|
||||
down the query. **The query will run forever until you call this.**
|
||||
|
||||
|
||||
{{> api_box cursor_observe_changes}}
|
||||
@@ -1004,10 +1003,9 @@ The document identified by `id` was removed from the result set.
|
||||
Before `observeChanges` returns, `added` (or `addedBefore`) will be called
|
||||
zero or more times to deliver the initial results of the query.
|
||||
|
||||
`observeChanges` returns a live query handle, which is an object with
|
||||
a `stop` method. Call this function with no arguments to stop calling
|
||||
the callback functions and tear down the query. **The query will run
|
||||
forever until you call this.**
|
||||
`observeChanges` returns a live query handle, which is an object with a `stop`
|
||||
method. Call `stop` with no arguments to stop calling the callback functions
|
||||
and tear down the query. **The query will run forever until you call this.**
|
||||
|
||||
{{#note}}
|
||||
Unlike `observe`, `observeChanges` does not provide absolute position
|
||||
@@ -2480,7 +2478,8 @@ When you add a type to EJSON, Meteor will be able to use that type in:
|
||||
|
||||
MongoDB cannot store most user-defined types natively on the server. Your
|
||||
type will work in Minimongo, and you can send it to the client using a custom
|
||||
publisher, but MongoDB only knows about the types defined in [BSON](http://bsonspec.org/).
|
||||
publisher, but MongoDB can only store the types defined in
|
||||
[BSON](http://bsonspec.org/).
|
||||
|
||||
{{/note}}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ Template.api.ejsonParse = {
|
||||
name: "EJSON.parse(str)",
|
||||
locus: "Anywhere",
|
||||
args: [ {name: "str", type: "String", descr: "A string to parse into an EJSON value."} ],
|
||||
descr: ["Parse a string into an EJSON value."]
|
||||
descr: ["Parse a string into an EJSON value. Throws an error if the string is not valid EJSON."]
|
||||
},
|
||||
|
||||
Template.api.ejsonStringify = {
|
||||
@@ -79,7 +79,9 @@ Template.api.ejsonStringify = {
|
||||
name: "EJSON.stringify(val)",
|
||||
locus: "Anywhere",
|
||||
args: [ {name: "val", type: "EJSON-compatible value", descr: "A value to stringify."} ],
|
||||
descr: ["Serialize an object to a string."]
|
||||
descr: ["Serialize a value to a string.\n\nFor EJSON values, the serialization " +
|
||||
"fully represents the value. For non-EJSON values, serializes the " +
|
||||
"same way as `JSON.stringify`."]
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ var BASE_64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456
|
||||
var BASE_64_VALS = {};
|
||||
|
||||
for (var i = 0; i < BASE_64_CHARS.length; i++) {
|
||||
BASE_64_VALS[BASE_64_CHARS.substr(i, 1)] = i;
|
||||
BASE_64_VALS[BASE_64_CHARS.charAt(i)] = i;
|
||||
};
|
||||
|
||||
EJSON._base64Encode = function (array) {
|
||||
@@ -54,7 +54,7 @@ EJSON._base64Encode = function (array) {
|
||||
};
|
||||
|
||||
var getChar = function (val) {
|
||||
return BASE_64_CHARS.substr(val, 1);
|
||||
return BASE_64_CHARS.charAt(val);
|
||||
};
|
||||
|
||||
var getVal = function (ch) {
|
||||
@@ -78,9 +78,9 @@ EJSON.newBinary = function (len) {
|
||||
|
||||
EJSON._base64Decode = function (str) {
|
||||
var len = Math.floor((str.length*3)/4);
|
||||
if (str.substr(str.length - 1) == '=') {
|
||||
if (str.charAt(str.length - 1) == '=') {
|
||||
len--;
|
||||
if (str.substr(str.length - 2, 1) == '=')
|
||||
if (str.charAt(str.length - 2) == '=')
|
||||
len--;
|
||||
}
|
||||
var arr = EJSON.newBinary(len);
|
||||
@@ -92,7 +92,7 @@ EJSON._base64Decode = function (str) {
|
||||
var j = 0;
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var c = str.substr(i, 1);
|
||||
var c = str.charAt(i);
|
||||
var v = getVal(c);
|
||||
switch (i % 4) {
|
||||
case 0:
|
||||
|
||||
@@ -156,7 +156,8 @@ the server having been upgraded.
|
||||
example, if subscription A says document `x` has fields `{foo: 1, bar: 2}`
|
||||
and subscription B says document `x` has fields `{foo: 1, baz:3}`, then the
|
||||
client will be informed that document `x` has fields `{foo: 1, bar: 2, baz:
|
||||
3}`
|
||||
3}`. If field values from different subscriptions conflict with each other,
|
||||
the server should send one of the possible field values.
|
||||
|
||||
* When one or more subscriptions have finished sending their initial batch of
|
||||
data, the server will send a `ready` message with their IDs.
|
||||
@@ -234,7 +235,9 @@ supports all types built into JSON as plain JSON, plus the following:
|
||||
|
||||
{"$binary": BASE_64_STRING}
|
||||
|
||||
Escaped things that might otherwise look like EJSON types:
|
||||
(The base 64 string has `+` and `/` as characters 62 and 63, and has no maximum line length)
|
||||
|
||||
**Escaped things** that might otherwise look like EJSON types:
|
||||
|
||||
{"$escape": THING}
|
||||
|
||||
@@ -252,4 +255,8 @@ to a Date object:
|
||||
|
||||
{"$type": TYPENAME, "$value": VALUE}
|
||||
|
||||
Implementations of EJSON should try to preserve key order where they can.
|
||||
Implementations of EJSON should try to preserve key order where they can. Users
|
||||
of EJSON should not rely on key order, if possible.
|
||||
|
||||
> MongoDB relies on key order. When using EJSON with MongoDB, the
|
||||
> implementation of EJSON must preserve key order.
|
||||
|
||||
@@ -7,6 +7,8 @@ var Fiber = __meteor_bootstrap__.require('fibers');
|
||||
|
||||
(function () {
|
||||
|
||||
|
||||
// Represents a single document in a SessionCollectionView
|
||||
Meteor._SessionDocumentView = function () {
|
||||
var self = this;
|
||||
self.existsIn = {}; // set of subscriptionHandle
|
||||
@@ -88,6 +90,7 @@ _.extend(Meteor._SessionDocumentView.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
// Represents a client's view of a single collection
|
||||
Meteor._SessionCollectionView = function (collectionName, sessionCallbacks) {
|
||||
var self = this;
|
||||
self.collectionName = collectionName;
|
||||
|
||||
@@ -23,7 +23,6 @@ LocalCollection._diffQueryUnorderedChanges = function (oldResults, newResults,
|
||||
throw new Error("_diffQueryUnordered called with a moved observer!");
|
||||
}
|
||||
|
||||
// "maybe deepcopy"
|
||||
_.each(newResults, function (newDoc) {
|
||||
if (_.has(oldResults, newDoc._id)) {
|
||||
var oldDoc = oldResults[newDoc._id];
|
||||
|
||||
Reference in New Issue
Block a user