We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
6.10.1
18.13.0
4.4.13
No response
Using 2dimensional document array throws Error 'Base SchemaType class does not implement a cast() function' while executing mongodb query
cast()
const multiArraySchema = new Schema({ label: String, arr: [Number] }) const baseTestSchema = new Schema({ baseLabel: String, mArr: [[multiArraySchema]] }) const mArrB = mongoose.model('multiBArray', baseTestSchema) const arrB = new mArrB({ baseLabel: 'testx', mArr: [[{ label: 'testInner', arr: [1, 2, 3, 4] }]] }) arrB.save().then(() => mArrB.updateOne({ baseLabel: 'testx' }, { $pullAll: { 'mArr.0.0.arr': [1, 2] } }))
the pullAll query to be executed
The text was updated successfully, but these errors were encountered:
const mongoose = require('mongoose'); const { Schema } = mongoose; const multiArraySchema = new Schema({ label: String, arr: [Number] }); const baseTestSchema = new Schema({ baseLabel: String, mArr: [[multiArraySchema]] }); const mArrB = mongoose.model('multiBArray', baseTestSchema); async function run() { await mongoose.connect('mongodb://localhost:27017'); await mongoose.connection.dropDatabase(); const arrB = new mArrB({ baseLabel: 'testx', mArr: [[{ label: 'testInner', arr: [1, 2, 3, 4] }]] }) await arrB.save(); const res = await mArrB.updateOne({ baseLabel: 'testx' }, { $pullAll: { 'mArr.0.0.arr': [1, 2] } }); console.log('what is res', res); } run();
Sorry, something went wrong.
fix(update): handle casting doubly nested arrays with $pullAll
378f1e0
Fix #13190
docs(schema): add missing jsdoc to DocumentArrayElement.prototype.clo…
110e542
…ne re: #13190
Merge pull request #13285 from Automattic/vkarpov15/gh-13190
fd4da49
No branches or pull requests
Prerequisites
Mongoose version
6.10.1
Node.js version
18.13.0
MongoDB server version
4.4.13
Typescript version (if applicable)
No response
Description
Using 2dimensional document array throws Error 'Base SchemaType class does not implement a
cast()
function' while executing mongodb querySteps to Reproduce
Expected Behavior
the pullAll query to be executed
The text was updated successfully, but these errors were encountered: