Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for setting subpopulated fields from within a plugin

  • Loading branch information...
commit 4a024c1df56fdd3e2ea663eef364c51153e88864 1 parent c5d974a
@JoshuaGross authored
Showing with 3 additions and 1 deletion.
  1. +2 −0  lib/mongoose-subpopulate.js
  2. +1 −1  package.json
View
2  lib/mongoose-subpopulate.js
@@ -360,7 +360,9 @@ function wrapModelObject (object) {
wrappedObject.__defineSetter__(attr, function (value) {
// Cache object references; Mongoose casts them to IDs and they're sort of lost.
if (value && value.mongooseLink) {
+ console.log('set subpopulated value');
wrappedObject.populatedObjects[value._id] = value;
+ object[attr] = value.mongooseLink;
object.set(attr, value.mongooseLink);
} else {
object[attr] = value;
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "mongoose-subpopulate",
- "version": "0.1.8",
+ "version": "0.1.9",
"main": "./lib/mongoose-subpopulate.js",
"scripts": {},
"repository": {
Please sign in to comment.
Something went wrong with that request. Please try again.