mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Revert "Binary support in BSON (dev bundle wise) and in Mongo"
This reverts commit c10c7f7c91.
Only revert the non-test portions, leaving failing tests. Will implement
binary-in-Mongo in a different way on this branch before merging back to
ddp-pre1. (Assuming that works, will also delete the 0.2.15 dev bundles from s3
and production.)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
set -e
|
||||
set -u
|
||||
|
||||
BUNDLE_VERSION=0.2.15
|
||||
BUNDLE_VERSION=0.2.14
|
||||
UNAME=$(uname)
|
||||
ARCH=$(uname -m)
|
||||
|
||||
@@ -131,13 +131,6 @@ mv ../$FIBERS_ARCH .
|
||||
cd ../..
|
||||
|
||||
|
||||
# We want to ship a custom BSON module to replace one of the Node Mongo driver's
|
||||
# dependencies. This allows us to return a Uint8Array as a form of binary data
|
||||
# instead of the Mongo driver's proprietary Binary object on the server.
|
||||
|
||||
cd $DIR/lib/node_modules/mongodb
|
||||
npm install https://github.com/meteor/js-bson/tarball/9b8958a039
|
||||
|
||||
# Download and install mongodb.
|
||||
# To see the mongo changelog, go to http://www.mongodb.org/downloads,
|
||||
# click 'changelog' under the current version, then 'release notes' in
|
||||
|
||||
2
meteor
2
meteor
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
BUNDLE_VERSION=0.2.15
|
||||
BUNDLE_VERSION=0.2.14
|
||||
|
||||
# OS Check. Put here because here is where we download the precompiled
|
||||
# bundles that are arch specific.
|
||||
|
||||
@@ -297,35 +297,6 @@ EJSON.clone = function (v) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
EJSON._recognizeAndReplace = function (document, recognize, transformer) {
|
||||
if (typeof document == 'object') {
|
||||
if (recognize(document))
|
||||
return transformer(document);
|
||||
if (document === null
|
||||
|| document instanceof Date
|
||||
|| typeof document.typeName === 'function')
|
||||
return document;
|
||||
if (document instanceof Array) {
|
||||
var newArr = [];
|
||||
_.each(document, function (val) {
|
||||
newArr.push(EJSON._recognizeAndReplace(val, recognize, transformer));
|
||||
});
|
||||
return newArr;
|
||||
} else {
|
||||
// plain object
|
||||
var newObj = {};
|
||||
_.each(document, function (val, key) {
|
||||
newObj[key] = EJSON._recognizeAndReplace(val, recognize, transformer);
|
||||
});
|
||||
return newObj;
|
||||
}
|
||||
} else {
|
||||
return document;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
EJSON._each2 = function (iterable, iterator) {
|
||||
var lastVal = null;
|
||||
var lastKey = null;
|
||||
@@ -336,6 +307,4 @@ EJSON._each2 = function (iterable, iterator) {
|
||||
});
|
||||
iterator(lastVal, lastKey, null, null);
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
|
||||
@@ -13,13 +13,6 @@ var MongoDB = __meteor_bootstrap__.require('mongodb');
|
||||
var Fiber = __meteor_bootstrap__.require('fibers');
|
||||
var Future = __meteor_bootstrap__.require(path.join('fibers', 'future'));
|
||||
|
||||
MongoDB.BSON.installUserDefinedBinaryHandler({
|
||||
toBuffer: function (arr) { return new Buffer(arr); },
|
||||
fromBuffer: function (buf) { return new Uint8Array(buf); },
|
||||
isBinary: function (obj) { return obj instanceof Uint8Array; },
|
||||
length: function (buf) { return buf.length; }
|
||||
});
|
||||
|
||||
_Mongo = function (url) {
|
||||
var self = this;
|
||||
|
||||
@@ -76,33 +69,6 @@ _Mongo.prototype._maybeBeginWrite = function () {
|
||||
return {committed: function () {}};
|
||||
};
|
||||
|
||||
var replaceUint8WithBinary = function (document) {
|
||||
if (typeof document == 'object') {
|
||||
if (EJSON.isBinary(document))
|
||||
return new MongoDB.Binary(document);
|
||||
if (document === null
|
||||
|| document instanceof Date
|
||||
|| typeof document.typeName === 'function')
|
||||
return document;
|
||||
if (document instanceof Array) {
|
||||
var newArr = [];
|
||||
_.each(document, function (val) {
|
||||
newArr.push(replaceUint8WithBinary(val));
|
||||
});
|
||||
return newArr;
|
||||
} else {
|
||||
// plain object
|
||||
var newObj = {};
|
||||
_.each(docment, function (val, key) {
|
||||
newObj[key] = replaceUint8WithBinary(val);
|
||||
});
|
||||
return newObj;
|
||||
}
|
||||
} else {
|
||||
return document;
|
||||
}
|
||||
};
|
||||
|
||||
//////////// Public API //////////
|
||||
|
||||
// The write methods block until the database has confirmed the write
|
||||
|
||||
Reference in New Issue
Block a user