Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Feng committed Jan 24, 2014
1 parent 0918675 commit 2790056
Show file tree
Hide file tree
Showing 7 changed files with 535 additions and 533 deletions.
66 changes: 33 additions & 33 deletions example/model.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
var DataSource = require('loopback-datasource-juggler').DataSource;

var config = require('rc')('loopback', {dev: {mongodb:{}}}).dev.mongodb;
var config = require('rc')('loopback', {dev: {mongodb: {}}}).dev.mongodb;

var ds = new DataSource(require('../'), config);

var Customer = ds.createModel('customer', {seq: {type: Number, id: true}, name: String, emails: [String], age: Number});

Customer.create({
seq: 1,
name: 'John1',
emails: ['john@x.com', 'john@y.com'],
age: 30
}, function(err, customer) {
console.log(customer.toObject());
seq: 1,
name: 'John1',
emails: ['john@x.com', 'john@y.com'],
age: 30
}, function (err, customer) {
console.log(customer.toObject());

/*
customer.updateAttributes({name: 'John'}, function(err, result) {
console.log(err, result);
});
/*
customer.updateAttributes({name: 'John'}, function(err, result) {
console.log(err, result);
});
customer.delete(function(err, result) {
customer.updateAttributes({name: 'JohnX'}, function(err, result) {
console.log(err, result);
});
customer.delete(function(err, result) {
customer.updateAttributes({name: 'JohnX'}, function(err, result) {
console.log(err, result);
});
});
*/
});
*/

Customer.findById(customer.seq, function(err, customer) {
console.log(customer.toObject());
Customer.findById(customer.seq, function (err, customer) {
console.log(customer.toObject());

customer.name = 'John';
customer.save(function(err, customer) {
console.log(customer.toObject());
ds.connector.close();
});
customer.name = 'John';
customer.save(function (err, customer) {
console.log(customer.toObject());
ds.connector.close();
});
});
});

/*
Customer.create({
id: 2,
name: 'John2',
emails: ['john@x.com', 'jhon@y.com'],
age: 30
}, function(err, customer) {
console.log(customer.toObject());
});
*/
Customer.create({
id: 2,
name: 'John2',
emails: ['john@x.com', 'jhon@y.com'],
age: 30
}, function(err, customer) {
console.log(customer.toObject());
});
*/
Loading

0 comments on commit 2790056

Please sign in to comment.