Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MongoID.ObjectID.prototype.typeName = function() {
return "oid";
};
MongoID.ObjectID.prototype.getTimestamp = function() {
var self = this;
return parseInt(self._str.substr(0, 8), 16);
};
MongoID.ObjectID.prototype.valueOf =
MongoID.ObjectID.prototype.toJSONValue =
MongoID.ObjectID.prototype.toHexString =
function () { return this._str; };
EJSON.addType("oid", function (str) {
return new MongoID.ObjectID(str);
});
MongoID.idStringify = function (id) {
if (id instanceof MongoID.ObjectID) {
return id.valueOf();
} else if (typeof id === 'string') {
if (id === "") {
return id;
} else if (id.substr(0, 1) === "-" || // escape previously dashed strings
id.substr(0, 1) === "~" || // escape escaped numbers, true, false
MongoID._looksLikeObjectID(id) || // escape object-id-form strings
id.substr(0, 1) === '{') { // escape object-form strings, for maybe implementing later
return "-" + id;
} else {
return id; // other strings go through unchanged.
};
MongoID.ObjectID.prototype.typeName = function() {
return 'oid';
};
MongoID.ObjectID.prototype.getTimestamp = function() {
var self = this;
return parseInt(self._str.substr(0, 8), 16);
};
MongoID.ObjectID.prototype.valueOf = MongoID.ObjectID.prototype.toJSONValue = MongoID.ObjectID.prototype.toHexString = function() {
return this._str;
};
EJSON.addType('oid', function(str) {
return new MongoID.ObjectID(str);
});
MongoID.idStringify = function(id) {
if (id instanceof MongoID.ObjectID) {
return id.valueOf();
} else if (typeof id === 'string') {
if (id === '') {
return id;
} else if (
id.substr(0, 1) === '-' || // escape previously dashed strings
id.substr(0, 1) === '~' || // escape escaped numbers, true, false
MongoID._looksLikeObjectID(id) || // escape object-id-form strings
id.substr(0, 1) === '{'
) {
// escape object-form strings, for maybe implementing later
import EJSON from 'ejson';
import Collection from '../Collection';
import Data from '../Data';
import setProperties from './setProperties';
if (!EJSON._getTypes()['FS.File']) {
EJSON.addType('FS.File', function(value) {
return {
getFileRecord() {
const collection =
Data.db['cfs.' + value.collectionName + '.filerecord'];
const item = collection && collection.get(value._id);
if (!item) return value;
return setProperties(value.collectionName, item);
},
};
});
}
export default function(name) {