Git Product home page Git Product logo

Comments (9)

nw avatar nw commented on May 12, 2024

have you tried defining a cast for that particular property?

casts: { account: ObjectID }

above your model you will need to define ObjectID. You should be able to do the following.

var ObjectID = require('mongodb').ObjectID

if you want the casting to be automatic you can just add an underscore to the name, and mongoose will handle the rest.

from mongoose.

naturalethic avatar naturalethic commented on May 12, 2024

I did try a cast how you suggested, but that also didn't work, and I use an underscore at the beginning of the field name. Keep in mind, the property is getting set on the object as I can see by inspecting the object before and after save, however when I view the object in the database, or load the object back up, that property is unset.

from mongoose.

nw avatar nw commented on May 12, 2024

and that particular property is defined in your properties: [] ?

for sanity checking you can inspect doc.__doc to see if the property is actually in the internal doc that gets saved down.

from mongoose.

naturalethic avatar naturalethic commented on May 12, 2024

Yes it is present in my properties array. It is present in the __doc. It is also marked as dirty. Every other field saves properly. If I inspect after I save, it is also still there. However, if I load it back up, or inspect it with MongoHub, it is empty.

from mongoose.

nw avatar nw commented on May 12, 2024

any other information you can provide would be great. Like what version of mongodb your connecting too. I have not seen this issue, I'll try and reproduce later.

from mongoose.

naturalethic avatar naturalethic commented on May 12, 2024

I'm using edge version of MongoDB.

from mongoose.

nw avatar nw commented on May 12, 2024

do you know what version of mongodb-native your using? It should be locked in at v0.7.9.

check out my comment on http://github.com/LearnBoost/mongoose/issues#issue/47 for reasons why.

from mongoose.

naturalethic avatar naturalethic commented on May 12, 2024

Ug. MongoHub is the culprit. It doesn't display ObjectID's other than _id apparently. I had thought I had tested without MongoHub but I must not have. Sorry to waste your time on this.

from mongoose.

nw avatar nw commented on May 12, 2024

resolved

from mongoose.

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.