5.12.6 dropped support for 4.4 projection expression
See original GitHub issuecritical bug
What is the current behavior?
mongoose version 5.12.6
dropped support for MongoDB 4.4 projection expressions.
In version 5.12.5
everything works as expected.
Reproduce script:
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const dbConnection = require('./conn')
const TestSchema = new Schema({
field: {
subField: String
}
});
TestSchema.statics.getSubField = function () {
return this.findOne({}, {
subField: '$field.subField'
}).lean().exec();
}
async function test () {
const connection = await dbConnection();
const TestModel = connection.model('TestModel', TestSchema);
const newTestModel = new TestModel({field: {subField: 'schema sub field value'}});
await newTestModel.save();
const res = await TestModel.getSubField();
console.log(res.subField);
await TestModel.deleteMany({}).exec();
}
test();
With version 5.12.5
console output:
/usr/bin/node /home/tom/WebstormProjects/test/model.js schema sub field value
With version 5.12.6
console output:
/usr/bin/node /home/tom/WebstormProjects/test/model.js undefined
same happens with find
What is the expected behavior?
the projection
in find
and findOne
queries, should support aggregation projection expressions, as in 5.12.5
and MongoDB 4.4
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that “latest” is not a version. Node.js - 14.16.1 Mongoose - 5.12.6 MongoDB - 4.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Projection expressions - Amazon DynamoDB
A projection expression is a string that identifies the attributes that you want. To retrieve a single attribute, specify its name. For multiple...
Read more >mongoose/CHANGELOG.md at master - GitHub
fix(schema): disallow using schemas with schema-level projection with map ... BREAKING CHANGE: drop support for Model#model #8958 AbdelrahmanHafez ...
Read more >afman63-143.pdf - Air Force
This Air Force (AF) Manual (AFMAN) implements and identifies Centralized Asset. Management (CAM) procedures referenced in Air Force ...
Read more >notice of proposed rulemaking - Mercatus Center
CHAPTER 1. INTRODUCTION. 1.1. PURPOSE OF THE DOCUMENT. This technical support document (TSD) is a stand-alone report that provides the technical.
Read more >View Publication - Defense Contract Management Agency
Sample Supporting Contract Administration Delegation Format ... Removed from military flight orders for cause.
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 Free
Top 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
I took a closer look and you’re right @tomgrossman , I’m very sorry for the difficulty. We made this fix in #10142 as a precaution, but you’re right that it also hides a useful feature. We will undo this change and release the fix in v5.12.9 👍
@tomgrossman