This is is the code where LocalCollection is
var simulateUpsertWithInsertedId = function (collection, selector, mod,
isModify, options, callback) {
// STRATEGY: First try doing a plain update. If it affected 0 documents,
// then without affecting the database, we know we should probably do an
// insert. We then do a conditional insert that will fail in the case
// of a race condition. This conditional insert is actually an
// upsert-replace with an _id, which will never successfully update an
// existing document. If this upsert fails with an error saying it
// couldn’t change an existing _id, then we know an intervening write has
// caused the query to match something. We go back to step one and repeat.
// Like all “optimistic write” schemes, we rely on the fact that it’s
// unlikely our writes will continue to be interfered with under normal
// circumstances (though sufficiently heavy contention with writers
// disagreeing on the existence of an object will cause writes to fail
// in theory).
var newDoc;
// Run this code up front so that it fails fast if someone uses
// a Mongo update operator we don’t support.
if (isModify) {
// We’ve already run replaceTypes/replaceMeteorAtomWithMongo on
// selector and mod. We assume it doesn’t matter, as far as
// the behavior of modifiers is concerned, whether _modify
// is run on EJSON or on mongo-converted EJSON.
var selectorDoc = LocalCollection._removeDollarOperators(selector);
newDoc = selectorDoc;
// Convert dotted keys into objects. (Resolves issue #4522).
_.each(newDoc, function (value, key) {
var trail = key.split(".");
if (trail.length > 1) {
//Key is dotted. Convert it into an object.
delete newDoc[key];
var obj = newDoc,
leaf = trail.pop();
// XXX It is not quite certain what should be done if there are clashing
// keys on the trail of the dotted key. For now we will just override it
// It wouldn't be a very sane query in the first place, but should look
// up what mongo does in this case.
while ((key = trail.shift())) {
if (typeof obj[key] !== "object") {
obj[key] = {};
}
obj = obj[key];
}
obj[leaf] = value;
}
});
LocalCollection._modify(newDoc, mod, {isInsert: true});
} else {
newDoc = mod;
}
var insertedId = options.insertedId; // must exist
var mongoOptsForUpdate = {
safe: true,
multi: options.multi
};
var mongoOptsForInsert = {
safe: true,
upsert: true
};
var tries = NUM_OPTIMISTIC_TRIES;
var doUpdate = function () {
tries–;
if (! tries) {
callback(new Error(“Upsert failed after " + NUM_OPTIMISTIC_TRIES + " tries.”));
} else {
collection.update(selector, mod, mongoOptsForUpdate,
bindEnvironmentForWrite(function (err, result) {
if (err) {
callback(err);
} else if (result && result.result.n != 0) {
callback(null, {
numberAffected: result.result.n
});
} else {
doConditionalInsert();
}
}));
}
};
var doConditionalInsert = function () {
var replacementWithId = _.extend(
replaceTypes({_id: insertedId}, replaceMeteorAtomWithMongo),
newDoc);
collection.update(selector, replacementWithId, mongoOptsForInsert,
bindEnvironmentForWrite(function (err, result) {
if (err) {
// figure out if this is a
// “cannot change _id of document” error, and
// if so, try doUpdate() again, up to 3 times.
if (MongoConnection._isCannotChangeIdError(err)) {
doUpdate();
} else {
callback(err);
}
} else {
callback(null, {
numberAffected: result.result.upserted.length,
insertedId: insertedId,
});
}
}));
};
doUpdate();
};
./meteor/packages
meteor-base@1.3.0 # Packages every Meteor app needs to have
mobile-experience@1.0.5 # Packages for a great mobile UX
mongo@1.4.2 # The database Meteor supports right now
reactive-var@1.0.11 # Reactive variable for tracker
jquery@1.11.10 # Helpful client-side library
tracker@1.1.3 # Meteor’s client-side reactive programming library
standard-minifier-css@1.4.0 # CSS minifier run for production mode
standard-minifier-js@2.3.1 # JS minifier run for production mode
es5-shim@4.7.0 # ECMAScript 5 compatibility for older browsers.
ecmascript@0.10.6 # Enable ECMAScript2015+ syntax in app code
shell-server@0.3.1 # Server-side component of the meteor shell command
service-configuration@1.0.11
accounts-base@1.4.2
static-html
react-meteor-data
dburles:collection-helpers
dburles:mongo-collection-instances
matb33:collection-hooks
themeteorchef:bert
poetic:apple-es-db-adapter
poetic:accounts-apple-connect
poetic:apple-es-db-logger
http@1.4.0
poetic:meteor-react-guard@2.2.0
ground:db@2.0.0-rc.7
dynamic-import
./Versions
accounts-base@1.4.2
allow-deny@1.1.0
autoupdate@1.4.0
babel-compiler@7.0.9
babel-runtime@1.2.2
base64@1.0.10
binary-heap@1.0.10
blaze@2.3.2
blaze-tools@1.0.10
boilerplate-generator@1.4.0
caching-compiler@1.1.9
caching-html-compiler@1.0.7
callback-hook@1.1.0
check@1.3.0
dburles:collection-helpers@1.1.0
dburles:mongo-collection-instances@0.3.5
ddp@1.4.0
ddp-client@2.3.2
ddp-common@1.4.0
ddp-rate-limiter@1.0.7
ddp-server@2.1.2
deps@1.0.12
diff-sequence@1.1.0
dynamic-import@0.3.0
ecmascript@0.10.6
ecmascript-runtime@0.5.0
ecmascript-runtime-client@0.6.2
ecmascript-runtime-server@0.5.0
ejson@1.1.0
es5-shim@4.7.0
fortawesome:fontawesome@4.4.0_1
fourseven:scss@3.8.1
geojson-utils@1.0.10
ground:db@2.0.0-rc.7
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.4.0
id-map@1.1.0
jquery@1.11.10
lai:collection-extensions@0.2.1_1
launch-screen@1.1.1
livedata@1.0.18
localstorage@1.2.0
logging@1.1.19
matb33:collection-hooks@0.8.4
meteor@1.8.2
meteor-base@1.3.0
minifier-css@1.3.0
minifier-js@2.3.5
minimongo@1.4.3
mobile-experience@1.0.5
mobile-status-bar@1.0.14
modules@0.11.3
modules-runtime@0.9.1
mongo@1.4.2
mongo-id@1.0.6
npm-mongo@2.2.33
observe-sequence@1.0.16
ordered-dict@1.1.0
poetic:accounts-apple-connect@0.0.1
poetic:apple-es-db-adapter@0.0.1
poetic:apple-es-db-logger@0.0.1
poetic:meteor-react-guard@2.3.0
promise@0.10.1
raix:eventemitter@0.1.3
raix:eventstate@0.0.4
random@1.1.0
rate-limit@1.0.8
react-meteor-data@0.2.9
reactive-dict@1.2.0
reactive-var@1.0.11
reload@1.2.0
retry@1.1.0
routepolicy@1.0.12
server-render@0.3.1
service-configuration@1.0.11
session@1.1.7
shell-server@0.3.1
shim-common@0.1.0
socket-stream-client@0.1.0
spacebars@1.0.13
spacebars-compiler@1.1.1
standard-minifier-css@1.4.0
standard-minifier-js@2.3.3
static-html@1.1.13
templating@1.2.14
templating-tools@1.1.1
themeteorchef:bert@2.1.1
tmeasday:check-npm-versions@0.2.0
tracker@1.1.3
underscore@1.0.10
url@1.2.0
webapp@1.5.0
webapp-hashing@1.0.9
./package.js
// XXX We should revisit how we factor MongoDB support into (1) the
// server-side node.js driver [which you might use independently of
// livedata, after all], (2) minimongo [ditto], and (3) Collection,
// which is the class that glues the two of them to Livedata, but also
// is generally the “public interface for newbies” to Mongo in the
// Meteor universe. We want to allow the components to be used
// independently, but we don’t want to overwhelm the user with
// minutiae.
Package.describe({
summary: “Adaptor for using MongoDB and Minimongo over DDP”,
version: ‘1.4.2’
});
Npm.depends({
“mongodb-uri”: “0.9.7”
});
Npm.strip({
mongodb: [“test/”]
});
Package.onUse(function (api) {
api.use(‘npm-mongo’, ‘server’);
api.use(‘allow-deny’);
api.use([
‘random’,
‘ejson’,
‘underscore’,
‘minimongo’,
‘ddp’,
‘tracker’,
‘diff-sequence’,
‘mongo-id’,
‘check’,
‘ecmascript’
]);
// Binary Heap data structure is used to optimize oplog observe driver
// performance.
api.use(‘binary-heap’, ‘server’);
// Allow us to detect ‘insecure’.
api.use(‘insecure’, {weak: true});
// Allow us to detect ‘autopublish’, and publish collections if it’s loaded.
api.use(‘autopublish’, ‘server’, {weak: true});
// Allow us to detect ‘disable-oplog’, which turns off oplog tailing for your
// app even if it’s configured in the environment. (This package will be
// probably be removed before 1.0.)
api.use(‘disable-oplog’, ‘server’, {weak: true});
// defaultRemoteCollectionDriver gets its deployConfig from something that is
// (for questionable reasons) initialized by the webapp package.
api.use(‘webapp’, ‘server’, {weak: true});
// If the facts package is loaded, publish some statistics.
api.use(‘facts’, ‘server’, {weak: true});
api.use(‘callback-hook’, ‘server’);
// Stuff that should be exposed via a real API, but we haven’t yet.
api.export(‘MongoInternals’, ‘server’);
// For tests only.
api.export(‘MongoTest’, ‘server’, {testOnly: true});
api.export(“Mongo”);
api.addFiles([‘mongo_driver.js’, ‘oplog_tailing.js’,
‘observe_multiplex.js’, ‘doc_fetcher.js’,
‘polling_observe_driver.js’,‘oplog_observe_driver.js’],
‘server’);
api.addFiles(‘local_collection_driver.js’, [‘client’, ‘server’]);
api.addFiles(‘remote_collection_driver.js’, ‘server’);
api.addFiles(‘collection.js’, [‘client’, ‘server’]);
api.addFiles(‘connection_options.js’, ‘server’);
});
Package.onTest(function (api) {
api.use(‘mongo’);
api.use(‘check’);
api.use([‘tinytest’, ‘underscore’, ‘test-helpers’, ‘ejson’, ‘random’,
‘ddp’, ‘base64’]);
// XXX test order dependency: the allow_tests “partial allow” test
// fails if it is run before mongo_livedata_tests.
api.addFiles(‘mongo_livedata_tests.js’, [‘client’, ‘server’]);
api.addFiles(‘upsert_compatibility_test.js’, ‘server’);
api.addFiles(‘allow_tests.js’, [‘client’, ‘server’]);
api.addFiles(‘collection_tests.js’, [‘client’, ‘server’]);
api.addFiles(‘observe_changes_tests.js’, [‘client’, ‘server’]);
api.addFiles(‘oplog_tests.js’, ‘server’);
api.addFiles(‘doc_fetcher_tests.js’, ‘server’);
});
This is only happening when i am trying to login, on starting server no errors are thrown