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