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.17 to 0.2.18

8

lib/model.js

@@ -361,9 +361,9 @@ var r = require('rethinkdb');

query.run({connection: connection, timeFormat: model.thinkyOptions.timeFormat}, function(error, result) {
if (result.toArray != null) {
if (result == null) {
callback(null, null);
}
else if (result.toArray != null) {
wrappedCallback = Model.prototype.callbacks.stream(self, callback);
wrappedCallback(null, result);
}
else if (result == null) {
callback(null, null);
}
else {

@@ -370,0 +370,0 @@ wrappedCallback = Model.prototype.callbacks.document(self, callback);

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

newLinkedModels = {};
newLinkedModels[model.getModel().name] = 1;
}

@@ -189,7 +190,18 @@ else {

if (newLinkedModels[fieldName] != null) {
var otherModelName = otherModel.getModel().name
if ((otherModelName !== model.getModel().name) && (newLinkedModels[otherModelName] >= 1)) {
continue;
}
newLinkedModels[fieldName] = true;
else if ((otherModelName === model.getModel().name) && (newLinkedModels[otherModelName] >= 2)) {
continue;
}
if (newLinkedModels[otherModelName] == null) {
newLinkedModels[otherModelName] = 1
}
else {
newLinkedModels[otherModelName]++
}
if (typeof joinClause === 'object') {

@@ -196,0 +208,0 @@ if (type === 'object') {

{
"name": "thinky",
"version": "0.2.17",
"version": "0.2.18",
"description": "RethinkDB ORM for Node.js",

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

@@ -1169,3 +1169,25 @@ var thinky = require('../lib/index.js');

it('should work for 1-1 relations for the same model', function(done) {
var Human = thinky.createModel('Human', {id: String, name: String, idFather: String});
Human.hasOne(Human, 'father', {leftKey: 'idFather', rightKey: 'id'});
var michel = new Human({name: "Michel"});
var hung = new Human({name: "Hung"});
michel['father'] = hung;
michel.save( {saveJoin: true}, function(error, firstResult) {
Human.get(michel.id).getJoin().run(function(error, result) {
should.not.exist(error);
should.exist(result.id);
should.exist(result.idFather);
should.exist(result.father.id);
done();
})
});
})
it('should work for n-n relations', function(done) {

@@ -1172,0 +1194,0 @@ var Cat = thinky.createModel('Cat', {id: String, name: String});

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