Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added toJSON method to models

  • Loading branch information...
commit a1d086860145f13e34c55b4bd7ac77b665bc9e2c 1 parent 8b3c8e8
@vdemedes authored
Showing with 9 additions and 2 deletions.
  1. +3 −0  lib/mongorito.coffee
  2. +4 −0 lib/mongorito.js
  3. +2 −2 package.json
View
3  lib/mongorito.coffee
@@ -65,6 +65,9 @@ class Model
fields
+ toJSON: ->
+ @fields()
+
@bakeModelsFromItems: (items, _model) ->
models = []
for item in items
View
4 lib/mongorito.js
@@ -97,6 +97,10 @@ Model = (function() {
return fields;
};
+ Model.prototype.toJSON = function() {
+ return this.fields();
+ };
+
Model.bakeModelsFromItems = function(items, _model) {
var field, item, model, models, _i, _len;
models = [];
View
4 package.json
@@ -1,6 +1,6 @@
{
"name": "mongorito",
- "version": "0.3.2",
+ "version": "0.3.3",
"description": "ODM for MongoDB.",
"keywords": ["mongo", "mongodb"],
"author": "Vadim Demedes <sbioko@gmail.com>",
@@ -13,6 +13,6 @@
"should": "*"
},
"main": "index",
- "engines": { "node": ">= 0.4.x" },
+ "engine": { "node": ">= 0.4.x" },
"license": "MIT"
}
Please sign in to comment.
Something went wrong with that request. Please try again.