Skip to content

Instantly share code, notes, and snippets.

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
<?php
/**
*
* LOL
*
* Output :
*
* bar0 : bar
* bar1 : bar
* bar2 : bar
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;
--- 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();
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}