-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mongoose.set('translateAliases', true) Not working in mongoose@8.3.1 #14521
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
IslandRhythms
added
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
labels
Apr 15, 2024
const mongoose = require('mongoose');
mongoose.set('translateAliases', true);
const main = async () => {
const uri = 'mongodb://localhost:27017';
const connection = mongoose.createConnection(uri, {
dbName: 'testdb',
});
connection.set('translateAliases', true);
console.debug('connection', connection);
const boo = 'boo';
const foo = 'foo';
const mongooseSchema = new mongoose.Schema({
B: {
alias: 'boo',
required: true,
unique: false,
type: String,
},
F: {
alias: 'foo',
required: true,
unique: true,
type: String,
},
});
const ExampleModel = connection.model('Example', mongooseSchema, 'example', {
overwriteModels: true,
});
const findResult = await ExampleModel.find({
boo,
});
console.debug('findResult', findResult);
const updateOneResult = await ExampleModel.updateOne(
{ boo },
{ foo },
{
upsert: true,
},
);
console.debug('updateOneResult', updateOneResult);
};
main(); |
vkarpov15
added a commit
that referenced
this issue
May 4, 2024
… error when using aliases Fix #14521
vkarpov15
added a commit
that referenced
this issue
May 6, 2024
fix(query): apply translateAliases before casting to avoid strictMode error when using aliases
This was referenced May 27, 2024
This was referenced Jun 7, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mongoose version
8.3.1
Node.js version
v20.11.0
MongoDB server version
6.0.2
Typescript version (if applicable)
5.3.3
Description
Steps to Reproduce
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: