Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Support for setting subpopulated fields from within a plugin

  • Loading branch information...
commit 4a024c1df56fdd3e2ea663eef364c51153e88864 1 parent c5d974a
Joshua Gross authored

Showing 2 changed files with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 0  lib/mongoose-subpopulate.js
  2. +1 1  package.json
2  lib/mongoose-subpopulate.js
@@ -360,7 +360,9 @@ function wrapModelObject (object) {
360 360 wrappedObject.__defineSetter__(attr, function (value) {
361 361 // Cache object references; Mongoose casts them to IDs and they're sort of lost.
362 362 if (value && value.mongooseLink) {
  363 + console.log('set subpopulated value');
363 364 wrappedObject.populatedObjects[value._id] = value;
  365 + object[attr] = value.mongooseLink;
364 366 object.set(attr, value.mongooseLink);
365 367 } else {
366 368 object[attr] = value;
2  package.json
... ... @@ -1,6 +1,6 @@
1 1 {
2 2 "name": "mongoose-subpopulate",
3   - "version": "0.1.8",
  3 + "version": "0.1.9",
4 4 "main": "./lib/mongoose-subpopulate.js",
5 5 "scripts": {},
6 6 "repository": {

0 comments on commit 4a024c1

Please sign in to comment.
Something went wrong with that request. Please try again.