Match error reported on '_id' field
See original GitHub issueWhen 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:
- Created 8 years ago
- Reactions:1
- Comments:7
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
Good idea