Mongo corrupted data maybe Ground db it is causing this


#1

We are experimenting a problem, we have our app hosted in modulus, when we deploy a new release, arbitrarily they begin to generate documents in different collections with ids that can be json objects with one property or dates , which causes the application to start throwing the error i mention above. After researching about it and did not find any solution beginning to believe that the error may be caused when the javascript code of the application is updated while even local database is synchronizing with the server, do you think is a problem with “GroundDB” ?.

Below i share the server log:

Exception while polling query {"collectionName":"appraisalSpaces","selector":{"userId":"qoiG5kZW5GZomg8ow"},"options":{}}: Error: Meteor does not currently support objects other than ObjectID as ids
    at [object Object].MongoID.idStringify [as _idStringify] (packages/mongo-id/id.js:73:1)
    at [object Object]._.extend.has (packages/id-map/id-map.js:31:1)
    at [object Object]._.extend._nextObject (packages/mongo/mongo_driver.js:998:1)
    at [object Object]._.extend.forEach (packages/mongo/mongo_driver.js:1020:1)
    at [object Object]._.extend.getRawObjects (packages/mongo/mongo_driver.js:1069:1)
    at [object Object]._.extend._pollMongo (packages/mongo/polling_observe_driver.js:147:1)
    at [object Object].proto._pollMongo (packages/meteorhacks_kadira/packages/meteorhacks_kadira.js:2725:1)
    at Object.task (packages/mongo/polling_observe_driver.js:85:1)
    at [object Object]._.extend._run (packages/meteor/fiber_helpers.js:147:1)
    at packages/meteor/fiber_helpers.js:125:1

We have already checked we’re not inserting these id values ​​intentionally in the application code.

Below I share some examples of bad generated records.

{ 
    "_id" : {
        "_str" : "d5a3251635572f651a476dc6"
    }, 
    "title" : "DASHBOARD.ACTIVITIES.STATUS_CHANGE_TITLE", 
    "text" : {
        "message" : "DASHBOARD.ACTIVITIES.STATUS_CHANGE_TEXT", 
        "data" : {
            "one" : "160201061", 
            "two" : "Agendada"
        }
    }, 
    "unitId" : "C59E6eXd6nALvdQGm", 
    "createdAt" : ISODate("2016-02-09T12:06:25.253+0000"), 
    "createdDate" : {
        "year" : "2016", 
        "month" : "2", 
        "day" : "9"
    }, 
    "createdBy" : "HXiQEzNkvFEpwhNGT", 
    "collection" : "activities"
}

{ 
    "_id" : ISODate("2016-02-11T16:03:37.590+0000"), 
    "typesId" : "SALA", 
    "typesName" : ISODate("2016-02-11T16:01:51.157+0000"), 
    "userId" : "qoiG5kZW5GZomg8ow", 
    "appraisalId" : "HbgvZdNJRhiCTdEkN", 
    "createdAt" : ISODate("2016-02-11T16:08:21.256+0000"), 
    "createdBy" : "qoiG5kZW5GZomg8ow", 
    "progress" : "Amo9hEyJenxN24wzC", 
    "collection" : "appraisalSpaces"
}

Aditional bellow i share all the packages that we have instaled in our application:

appcache
iron:router
accounts-password
accounts-base
tap:i18n
nimble:restivus
copleykj:mesosphere
alanning:roles
momentjs:moment
less
http
underscorestring:underscore.string
meteorhacks:ssr
fixtures
anti:fake
u2622:persistent-session
mrt:moment-timezone
matb33:collection-hooks
stevezhu:lodash
meteorhacks:npm
reactive-var
mrt:moment
risul:accounting
mdg:geolocation
lookback:emails
blackcore:google-maps
meteorhacks:aggregate
percolate:synced-cron
standard-minifiers
meteor-base
mobile-experience
mongo
blaze-html-templates
session
jquery
tracker
logging
reload
random
ejson
spacebars
check
miro:json2html
ground:db
tap:i18n-bundler
mnmtanish:call
rafaelhdr:google-charts
kadira:debug
The actual version of meteor in our app is 1.2.1

Did you have any idea what is happening?

Greatly appreciated your help , Regards


"Exception while polling query" with MLab and Meteor 1.4
#2

We found that not only bad ids inserted , there are also times when it inserts values ​​into keys that do not correspond


#3

Something is inserting raw Mongo.ObjectID objects for your _id values. Are you using something like new Mongo.ObjectID() anywhere in your code, for inserts/updates? If so you might want to change it to use something like new Mongo.ObjectID().toHexString() instead.

The above being said it’s a bit difficult to troubleshoot without seeing any code. If you’re able to reproduce the issue regularly you might want to consider working backwards, removing code/packages until the issue disappears, to help troubleshoot.


#4

When you use the mongo shell to insert records into a collection, it defaults to Mongo.ObjectID. Maybe there is an out-of-band process that modifies your mongo collection(s)?


#5

We replicated the problem by generating many records when meteor was offline (inserting 1000 records approximately in a for loop), and then reconnecting meteor is beginning to generate records with malformed ids again, we solve it by installing the ARK -Technology fork of minimax library ( https://github.com/ARK-Technology/minimax ). Thanks for the help, regards.


#6

This one fixed it for me: https://github.com/meteor/meteor/issues/4193