Skip to content
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

Not working with mongoose 4.0.4 when in embedded array item #2

Open
mikalai-sauchanka opened this issue Jun 1, 2015 · 2 comments
Open
Milestone

Comments

@mikalai-sauchanka
Copy link

Getting: [Error: Unable to invalidate a subdocument that has not been added to an array.]

'use strict';
var co = require('co'),
    mongoose = require('mongoose'),
    mongooseLong = require('mongoose-long');

mongooseLong(mongoose);
mongoose.connect('mongodb://localhost/dummy');

var dummySchema = new mongoose.Schema({
        foo: mongoose.Schema.Types.Long
    }, {_id: false}),
    schema = new mongoose.Schema({
        dummies: [dummySchema]
    }),
    DummyModel = mongoose.model('Dummy', schema);

co(function *() {
    let dummy = new DummyModel({});
    yield dummy.save();

    yield DummyModel.update(
        {_id: dummy._id},
        {$push: {dummies: {foo: 1}}}
    ).lean().exec();

    process.exit(0);
}).catch(function (err) {
    console.error(err);
    process.exit(1);
});
@vkarpov15 vkarpov15 added this to the 0.1.0 milestone Jun 1, 2015
@CreativeWarlock
Copy link

So is this project dead or is this issue ignored?

@vkarpov15
Copy link
Member

Not ignored, just got lost in the shuffle. Our practice for handling issues across multiple repos was much worse in 2015 :( Going to take a look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants