Provides Double support for mongoose.js
JavaScript
Permalink
Failed to load latest commit information.
lib release 0.0.1 Nov 16, 2012
test tests; add example of nested schemas working Jul 8, 2013
.gitignore release 0.0.1 Nov 16, 2012
.npmignore release 0.0.1 Nov 16, 2012
.travis.yml .travis again Feb 21, 2013
History.md release 0.0.1 Nov 16, 2012
LICENSE release 0.0.1 Nov 16, 2012
Makefile release 0.0.1 Nov 16, 2012
README.md fix travis img Feb 21, 2013
index.js release 0.0.1 Nov 16, 2012
package.json package version Nov 16, 2012

README.md

#mongoose-double

Provides Double support for Mongoose.

Build Status

Example:

var mongoose = require('mongoose')
require('mongoose-double')(mongoose);

var SchemaTypes = mongoose.Schema.Types;
var mySchema = new Schema({ double: SchemaTypes.Double });
var Xaction = db.model('Xaction', mySchema);

var x = new Xaction({ double: 47758.00 });

x.save(function (err) {
  Xaction.findById(x, function (err, doc) {
    console.log(doc.double.value);
    doc.double.value += 484.134;
    doc.save(cb);
  });
});

Values are cast to instances of Double. The value you pass is stored in the doubles value property.

x.double = 40;
console.log(x.double)       // { _bsontype: 'Double', value: 40 }
console.log(x.double.value) // 40

// or use `valueOf()`
console.log(x.double.valueOf()) // 40

install

npm install mongoose-double

See node-mongodb-native docs on all the Double methods available.

LICENSE