This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collection = require "../lib/collection" | |
{_,config,async,Validator,Filter,i18n,errors} = require "smax-utils" | |
{EValidator} = errors.store | |
config.store ?= {} | |
config.store.devices ?= {} | |
config.store.devices.redis ?= "127.0.0.1:6379": {} | |
config.store.devices.keyPrefix ?= "devices" | |
class Devices extends Collection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* LOL | |
* | |
* Output : | |
* | |
* bar0 : bar | |
* bar1 : bar | |
* bar2 : bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema; | |
function NotFound(msg){ | |
this.name = 'NotFound'; | |
Error.call(this, msg); | |
Error.captureStackTrace(this, arguments.callee); | |
} | |
NotFound.prototype.__proto__ = Error.prototype; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- node_modules/mongoose/lib/mongoose/schema/number.js 2011-06-08 14:42:22.000000000 +0200 | |
+++ version2 2011-06-08 14:40:37.000000000 +0200 | |
@@ -84,8 +84,11 @@ | |
SchemaNumber.prototype.cast = function (value, doc) { | |
if (!isNaN(value)){ | |
if (null === value) return value; | |
- if ('' === value) return null; | |
- if ('string' === typeof value) value = Number(value); | |
+ if ('string' === typeof value) { | |
+ value = value.trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose') | |
, Futures = require('futures') | |
, Schema = mongoose.Schema | |
, db = mongoose.connect('mongodb://localhost/mongoose-db'); | |
var UserSchema = new Schema({ | |
"name": {type: String}, | |
"location": { | |
"latitude": {type: Number, required: true, min: -90, max: 90}, | |
"longitude": {type: Number, required: true, min: -180, max: 180} |