question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Match error reported on '_id' field

See original GitHub issue

When validating collection documents against a schema (of type SimpleSchema), I get the following Match error: _id is not allowed by the schema

Stack trace of Match Error:

W20150623-22:26:48.348(2)? (STDERR) Error: Match error: _id is not allowed by the schema
W20150623-22:26:48.348(2)? (STDERR)     at [object Object].SimpleSchema.condition (packages/aldeed:simple-schema/simple-schema.js:602:1)
W20150623-22:26:48.349(2)? (STDERR)     at checkSubtree (packages/check/match.js:220:1)
W20150623-22:26:48.349(2)? (STDERR)     at check (packages/check/match.js:32:1)
W20150623-22:26:48.349(2)? (STDERR)     at app/server/bootstrap.js:72:5
W20150623-22:26:48.349(2)? (STDERR)     at [object Object]._.extend.forEach (packages/mongo/mongo_driver.js:965:1)
W20150623-22:26:48.349(2)? (STDERR)     at [object Object].Cursor.(anonymous function) [as forEach] (packages/mongo/mongo_driver.js:812:1)
W20150623-22:26:48.349(2)? (STDERR)     at validateFosMap (app/server/bootstrap.js:71:20)
W20150623-22:26:48.349(2)? (STDERR)     at app/server/bootstrap.js:2:3
W20150623-22:26:48.349(2)? (STDERR)     at /home/.../boot.js:229:5

Code from ‘bootstrap.js’:

function validateFosMap() {
  var qualFosMapCursor = QualificationFieldOfStudyMap.find();

  qualFosMapCursor.forEach(function (fosMapping) {
    check(fosMapping, QualificationFieldOfStudySchema);
  });
}

Schema definition:

QualificationFieldOfStudySchema = new SimpleSchema({
  fieldOfStudy: {
    type: String,
    label: 'Field of Study'
  },
  mappedKeywords: {
    type: [String],
    label: 'Mapped Keywords',
    minCount: 1
  },
  fieldOfStudyId: {
    type: String,
    label: 'ID (don\'t set or update)',
    autoValue: function () {
      var fos = this.field('fieldOfStudy');
      if (fos.isSet) {
        return fos.value.replace(/\s/g, ''); // remove spaces
      } else {
        this.unset(); // prevent user from setting their own value
      }
    }
  }
})

Example document:

{
  "_id" : ObjectId("5585630935f8834cf6939a59"),
  "fieldOfStudy" : "Theology",
  "fieldOfStudyId" : "Theology",
  "mappedKeywords" : [ "theology", "ministry" ] 
}

Please let me know if I can provide any additional information.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

4reactions
cyrus-zacommented, Dec 16, 2015

any update on this? This is currently a blocker as we need to use ObjectId with the data coming from other systems outside of meteor

0reactions
aldeedcommented, Nov 12, 2015

Good idea

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connector Error: Can't Mix and Match Fields from Different ...
Cause. You will receive this error when you have attempted to create a chart with two or more fields that do not share...
Read more >
I get a message about data type mismatch - Microsoft Support
I get a message about data type mismatch ... This error indicates that Access cannot match an input value to the data type...
Read more >
Error 'FIELD_FILTER_VALIDATION_EXCEPTION' on lookup ...
The error message "FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria," occurs when there are Lookup ...
Read more >
Blank 'id' field returned by findAll() query. Thus causing error
It clearly means that the findAll() method on PurchaseReceipt entity is giving back the expected results but with blank 'id' s. This is...
Read more >
Salesforce Error: "ID Value of Incorrect Type"
For example, some fields in Salesforce can only accept certain ID types (e.g., Contact ID, Account ID, etc.). If you map a value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found