Socket
Socket
Sign inDemoInstall

mongoose

Package Overview
Dependencies
Maintainers
0
Versions
883
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

7

History.md
1.1.1 / 2011-03-01
==================
* Added SchemaType String `lowercase`, `uppercase`, `trim`.
* Public exports (`Model`, `Document`) and tests.
* Added ObjectId casting support for `Document`s.
1.1.0 / 2011-02-25

@@ -3,0 +10,0 @@ ==================

19

lib/mongoose/index.js

@@ -14,2 +14,3 @@

, Model = require('./model')
, Document = require('./document')
, utils = require('./utils');

@@ -284,3 +285,3 @@

exports.version = '1.1.0';
exports.version = '1.1.1';

@@ -352,2 +353,18 @@ /**

/**
* Export Model constructor
*
* @api public
*/
exports.Model = Model;
/**
* Export Document constructor
*
* @api public
*/
exports.Document = Document;
/**
* Export MongooseError

@@ -354,0 +371,0 @@ *

@@ -48,6 +48,12 @@

if (value === null) return value;
if (value instanceof oid)
return value;
if (value._id && value._id instanceof oid)
value = value._id;
if (value.toString)
return oid.fromString(value.toString());
throw new CastError('object id', value);

@@ -54,0 +60,0 @@ };

@@ -59,2 +59,38 @@

/**
* Adds a lowercase setter
*
* @api public
*/
SchemaString.prototype.lowercase = function () {
return this.set(function (v) {
return v.toLowerCase();
});
};
/**
* Adds an uppercase setter
*
* @api public
*/
SchemaString.prototype.uppercase = function () {
return this.set(function (v) {
return v.toUpperCase();
});
};
/**
* Adds a trim setter
*
* @api public
*/
SchemaString.prototype.trim = function () {
return this.set(function (v) {
return v.trim();
});
};
/**
* Sets a regexp test

@@ -83,3 +119,2 @@ *

/**

@@ -86,0 +121,0 @@ * Casts to String

2

package.json
{
"name": "mongoose"
, "description": "Mongoose MongoDB ORM"
, "version": "1.1.0"
, "version": "1.1.1"
, "author": "Guillermo Rauch <guillermo@learnboost.com>"

@@ -6,0 +6,0 @@ , "keywords": ["mongodb", "mongoose", "orm", "data", "datastore", "nosql"]

@@ -189,4 +189,16 @@

});
},
'test public exports': function () {
mongoose.version.should.be.a('string');
mongoose.Collection.should.be.a('function');
mongoose.Connection.should.be.a('function');
mongoose.Schema.should.be.a('function');
mongoose.SchemaType.should.be.a('function');
mongoose.Query.should.be.a('function');
mongoose.Promise.should.be.a('function');
mongoose.Model.should.be.a('function');
mongoose.Document.should.be.a('function');
}
};

@@ -9,2 +9,3 @@

, Schema = mongoose.Schema
, Document = mongoose.Document
, SchemaType = mongoose.SchemaType

@@ -21,2 +22,24 @@ , VirtualType = mongoose.VirtualType

/**
* Test Document constructor.
*/
function TestDocument () {
Document.apply(this, arguments);
};
/**
* Inherits from Document.
*/
TestDocument.prototype.__proto__ = Document.prototype;
/**
* Set a dummy schema to simulate compilation.
*/
TestDocument.prototype.schema = new Schema({
test : String
});
/**
* Test.

@@ -302,2 +325,5 @@ */

var doc = new TestDocument()
, id = doc._id.toString();
Loki.path('owner').cast('4c54f3453e688c000000001a')

@@ -308,2 +334,7 @@ .should.be.an.instanceof(DocumentObjectId);

.should.be.an.instanceof(DocumentObjectId);
Loki.path('owner').cast(doc)
.should.be.an.instanceof(DocumentObjectId);
Loki.path('owner').cast(doc).toString().should.eql(id);
},

@@ -526,2 +557,26 @@

'test string built-in setter `lowercase`': function () {
var Tobi = new Schema({
name: { type: String, lowercase: true }
});
Tobi.path('name').applySetters('WHAT').should.eql('what');
},
'test string built-in setter `uppercase`': function () {
var Tobi = new Schema({
name: { type: String, uppercase: true }
});
Tobi.path('name').applySetters('what').should.eql('WHAT');
},
'test string built-in setter `trim`': function () {
var Tobi = new Schema({
name: { type: String, uppercase: true, trim: true }
});
Tobi.path('name').applySetters(' what ').should.eql('WHAT');
},
'test getter(s)': function(){

@@ -528,0 +583,0 @@ function woot (v) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc