Skip to content

Commit c2de938

Browse files
committed
changes to support mongoose 3.0
1 parent 135a83f commit c2de938

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function tree(schema, options) {
2222
});
2323

2424
schema.pre('save', function(next) {
25-
var isParentChange = this.modifiedPaths.indexOf('parent') !== -1;
25+
var isParentChange = this.isModified('parent');
2626

2727
if(this.isNew || isParentChange) {
2828
if(!this.parent) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"version": "0.0.1",
1212
"engine": "node >= 0.4.0",
1313
"dependencies": {
14-
"mongoose": "~2.7.1"
14+
"mongoose": "~3.0.0"
1515
},
1616
"devDependencies": {
1717
"async": "~0.1.22",

test/tree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('tree tests', function() {
6464
emily.remove(function(err) {
6565
should.not.exist(err);
6666

67-
User.find({}, ['name'], function(err, users) {
67+
User.find(['name'], function(err, users) {
6868
should.not.exist(err);
6969
users.length.should.equal(4);
7070
_.pluck(users, 'name').should.not.include('Emily');
@@ -80,7 +80,7 @@ describe('tree tests', function() {
8080
user.remove(function(err) {
8181
should.not.exist(err);
8282

83-
User.find({}, ['name'], function(err, users) {
83+
User.find(['name'], function(err, users) {
8484
should.not.exist(err);
8585

8686
users.length.should.equal(2);

0 commit comments

Comments
 (0)