Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

thinky

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thinky - npm Package Compare versions

Comparing version 0.2.16 to 0.2.17

11

lib/model.js

@@ -510,2 +510,12 @@ var r = require('rethinkdb');

}
Model.prototype.delete = function(callback) {
var query = new Query(this);
query = query.delete(callback);
return query;
}
Model.prototype.update = function(update, callback) {
var query = new Query(this);
query = query.update(update, callback);
return query;
}

@@ -516,2 +526,3 @@

// Events

@@ -518,0 +529,0 @@ Model.prototype.addListener = function(eventKey, listener) {

14

lib/query.js

@@ -77,2 +77,3 @@ var r = require('rethinkdb');

Query.prototype.limit = function(limit, callback) {

@@ -312,8 +313,19 @@ this.query = this.query.limit(limit);

if (typeof callback === 'function') {
this.run(callback);
this.execute(callback);
}
return this;
}
Query.prototype.update = function(update, callback) {
// Chain with update
this.query = this.query.update(update);
// Execute if a callback is passed
if (typeof callback === 'function') {
this.execute(callback);
}
return this
}
// Specifies fields that should be returned as query result

@@ -320,0 +332,0 @@ // http://www.rethinkdb.com/api/#js:document_manipulation-pluck

2

package.json
{
"name": "thinky",
"version": "0.2.16",
"version": "0.2.17",
"description": "RethinkDB ORM for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -581,2 +581,30 @@ var thinky = require('../lib/index.js');

describe('update', function() {
it('should update all docs', function(done){
Cat = thinky.createModel('Cat', { id: String, name: String, privateField: String });
Cat.update({newField: "newValue"}, function(error, result) {
if (error) throw error;
should(result.errors == 0);
should(result.replaced > 0);
done();
})
})
});
describe('delete', function() {
it('should delete all docs', function(done){
Cat = thinky.createModel('Cat', { id: String, name: String, privateField: String });
Cat.delete(function(error, result) {
if (error) throw error;
should(result.errors == 0);
should(result.deleted > 0);
Cat.run(function(error, result) {
if (error) throw error;
should(result.length == 0);
done();
})
})
})
});
describe('without', function() {

@@ -583,0 +611,0 @@ var Cat;

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