GithubHelp home page GithubHelp logo

mongoosefiller's People

Contributors

pgherveou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

nvdnkpr hellmagic

mongoosefiller's Issues

Subdocument not populating until child is changed...

Hey man, awesome concept and could really help solve the natural headache of NoSQL solutions!

I'm trying to integrate this with my project, and the example collections are similar to the following:

var GearSchema = new mongoose.Schema({
  name: { type: String }
});

var Gear = mongoose.model('Gear', GearSchema);

var BrandSchema = new mongoose.Schema({
  name: { type: String }
});

var Brand = mongoose.model('Brand', BrandSchema);

...

Now assuming I have a couple brands in the brands collection like follows:

[{ name: 'Canon', _id: 1 }, { name: 'Nikon', _id: 2 }]

If I create a new Gear like so:

var gear = new Gear({ name: '5D Mark II', brand: { _id: 1 }});

gear.save();

...the gear will simply have brand populated with the _id as I passed it in, like this:

{ name: '5D Mark II', brand: { _id: 1 }}

If I then modify the associated brand/child item (like changing its name), the gear item finally gets populated correctly.

Am I missing something?

Thanks!

Add support for mongoose 4.x

I'm not sure if any code updates are required to support 4.x but when I try to do an npm install in an application that has 4.x installed I get the following error:

npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package mongoose does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants [email protected]

If lucky, updating the version in package.json may be all that is required.

Filling multiple paths?

May seem like a stupid question, but what's the syntax/method for filling multiple paths within a single model (from different sources)?

Thanks (again)!

How to set a fields to be inside a key of nested array.

Great plugin! Loving it. This not an issue, unless it's not possible, in which case it's a feature request. Had a quick question about updating embedded arrays...

Say you've got a standard User model, and the following:

var VoteSchema = mongoose.Schema({
  vote              : { type: Number }
});

var ItemSchema = mongoose.Schema({
  text              : { type: String, },
  votes             : [VoteSchema]
});

VoteSchema.plugin(filler, {
  ref  : 'User',
  dest : 'Claim',
  pos  : 'votes.$.',
  select : 'firstName lastName'
});

This works wonderfully (thanks again!), but it returns the user fields at the same level of 'vote'. So you get this...

votes = [
 { firstName: 'blah', lastName: 'blah', vote: 1 }
]

Is it possible to make it sync the user fields behind a 'user' key, like this:

votes = [
 { user: { firstName: 'blah', lastName: 'blah'}, vote: 1 }
]

Thanks for your help.

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.