Giter VIP home page Giter VIP logo

Comments (7)

fxpoet avatar fxpoet commented on July 18, 2024 2

+1 same issue.but I solved with stopgap.
add single line code at line 138, node_modules/camo/lib/document.js

data = that._toData({_id:false});
line139: return DB().save(that.collectionName(), that._id, data);

from camo.

vfreitas- avatar vfreitas- commented on July 18, 2024

+1 Same here, I'm trying to set a property value in the preSave hook, but the changes are being lost.

preSave() {
    this.slug = slugify(this.title); //this.title = 'some phrase'
    console.log(this.slug); // 'some-phrase'
        //mongodb = null
}

from camo.

michaeljota avatar michaeljota commented on July 18, 2024

He is unable to work on it right now. But as soon as he can, he will look at it.

I just created a function to hash the password and called before the saving. It might work (It should at least, I hadn't try it).

It might work for you as well. :D

from camo.

michaeljota avatar michaeljota commented on July 18, 2024

Update: It works!. Just use the function that make changes in the object and called before salving. :D.

from camo.

michaeljota avatar michaeljota commented on July 18, 2024

Update2: I use password getter and setter to hash the password.

    set password (password) {
        this._password = password;
        this.salt = this.makeSalt();
        this.hashedPassword = this.encryptPassword(password);
    }

    get password () {
        return this._password;
    }

That solve my problem too, and it's easies to use, 'cause I just create the document with the 'password' param, and it actually hash the password, resulting:

{"name":"Test User","email":"[email protected]","hashedPassword":"(hashedPassword)","role":"user","provider":"local","salt":"(salt)","_id":"KNW4kT5nqj5cTg4V"}

from camo.

kurdin avatar kurdin commented on July 18, 2024

data = that._toData({_id:false});

Can you add this please and release new version?

from camo.

caseyWebb avatar caseyWebb commented on July 18, 2024

PRs! PRs for everyone!

from camo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.