File tree Expand file tree Collapse file tree 3 files changed +201
-165
lines changed Expand file tree Collapse file tree 3 files changed +201
-165
lines changed Original file line number Diff line number Diff line change 1
1
var Schema = require ( 'mongoose' ) . Schema ;
2
2
var streamWorker = require ( 'stream-worker' ) ;
3
+ var shortId = require ( 'shortid' ) ;
3
4
4
5
module . exports = exports = tree ;
5
6
@@ -28,11 +29,11 @@ function tree(schema, options) {
28
29
*/
29
30
schema . add ( {
30
31
parent : {
31
- type : Schema . ObjectId ,
32
+ type : String ,
32
33
set : function ( val ) {
33
- return ( val instanceof Object && val . _id ) ? val . _id : val ;
34
+ return ( val instanceof Object && val . _id ) ? val . _id . toString ( ) : val ;
34
35
} ,
35
- index : true
36
+ unique : true
36
37
} ,
37
38
path : {
38
39
type : String ,
Original file line number Diff line number Diff line change 20
20
"engine" : " node >= 0.4.0" ,
21
21
"dependencies" : {
22
22
"mongoose" : " 3.x.x" ,
23
- "stream-worker" : " 0.x.x"
23
+ "stream-worker" : " 0.x.x" ,
24
+ "shortid" : " 2.0.0"
24
25
},
25
26
"devDependencies" : {
26
27
"async" : " 0.x.x" ,
You can’t perform that action at this time.
0 commit comments