“describe”和“schema.define”有什么区别?

当我通过CompoundJS的世界取得进展时,我遇到了两种定义模式的方法:

第一:

var Product = describe('Product', function () { property('upc', String); property('name', String); set('restPath', pathTo.products); }); 

第二:

 var Schema = require('jugglingdb').Schema; var schema = new Schema('memory'); var Product = schema.define('Product', { upc: { type: Number, index: true }, name: { type: String, limit: 150, index: true }, createdAt: { type: Date, default: Date.now }, modifiedAt: { type: Date, default: Date.now } }, { restPath: pathTo.products }); 

第一,工程,但看起来像一个旧的devise。 第二,不起作用,但这是按照JugglingDB文档的方式。

我应该使用哪一个? 为什么第二个为我工作?

更新:这是我使用第二个时得到的错误:

 Express 500 TypeError: Cannot call method 'all' of undefined in products controller during "index" action at Object.index (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\app\controllers\products.js:47:13) at Array.2 (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\node_modules\compound\node_modules\kontroller\lib\flow-control.js:150:28) at ActionContext.run [as innerNext] (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\node_modules\compound\node_modules\kontroller\lib\flow-control.js:103:31) at Controller.BaseController.next (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\node_modules\compound\node_modules\kontroller\lib\base.js:107:22) at Controller.protectFromForgery (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\node_modules\compound\node_modules\kontroller\lib\helpers.js:76:21) at Object.protectFromForgeryHook (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\app\controllers\application.js:3:13) at Array.1 (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\node_modules\compound\node_modules\kontroller\lib\flow-control.js:150:28) at run (C:\Users\Eran\Documents\Relay Foods\nutrition-facts-editor\node_modules\compound\node_modules\kontroller\lib\flow-control.js:103:31) ... snip ... 

我认为describedefine是一样的。 这里的问题是我第一次实施的全球使用范围和第二次实施的本地化的使用范围。 所以我需要它是全球性的,以便与其他应用程序一起工作。