Skip to content

Commit

Permalink
Update README examples to comma last style
Browse files Browse the repository at this point in the history
alphabetize lint rules
resolve new lint warnings
  • Loading branch information
ChristianMurphy committed Nov 7, 2015
1 parent 352d80d commit aac346a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
17 changes: 9 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ env:
mocha: true

rules:
comma-style: 2
consistent-this:
- 1
- _this
indent:
- 2
- 2
- SwitchCase: 1
VariableDeclarator: 2
no-trailing-spaces: 2
comma-style: 2
no-spaced-func: 2
key-spacing: 1
no-console: 0
no-multi-spaces: 1
no-spaced-func: 2
no-trailing-spaces: 2
semi: 2
space-after-keywords: 2
space-before-blocks: 2
space-before-function-paren:
Expand All @@ -23,8 +29,3 @@ rules:
space-infix-ops: 2
space-return-throw-case: 2
space-unary-ops: 1
no-console: 0
consistent-this:
- 1
- _this
semi: 2
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/my_database');
```

Once connected, the `open` event is fired on the `Connection` instance. If you're using `mongoose.connect`, the `Connection` is `mongoose.connection`. Otherwise, `mongoose.createConnection` return value is a `Connection`.
Once connected, the `open` event is fired on the `Connection` instance. If you're using `mongoose.connect`, the `Connection` is `mongoose.connection`. Otherwise, `mongoose.createConnection` return value is a `Connection`.

**Note:** _If the local connection fails then try using 127.0.0.1 instead of localhost. Sometimes issues may arise when the local hostname has been changed._

Expand All @@ -68,14 +68,14 @@ Once connected, the `open` event is fired on the `Connection` instance. If you'r
Models are defined through the `Schema` interface.

```js
var Schema = mongoose.Schema
, ObjectId = Schema.ObjectId;
var Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;

var BlogPost = new Schema({
author : ObjectId
, title : String
, body : String
, date : Date
author : ObjectId,
title : String,
body : String,
date : Date
});
```

Expand All @@ -96,11 +96,11 @@ The following example shows some of these features:

```js
var Comment = new Schema({
name : { type: String, default: 'hahaha' }
, age : { type: Number, min: 18, index: true }
, bio : { type: String, match: /[a-z]/ }
, date : { type: Date, default: Date.now }
, buff : Buffer
name : { type: String, default: 'hahaha' },
age : { type: Number, min: 18, index: true },
bio : { type: String, match: /[a-z]/ },
date : { type: Date, default: Date.now },
buff : Buffer
});

// a setter
Expand Down Expand Up @@ -269,19 +269,19 @@ Moreover, you can mutate the incoming `method` arguments so that subsequent midd

```js
new Schema({
broken: { type: Boolean }
, asset : {
name: String
, type: String // uh oh, it broke. asset will be interpreted as String
broken: { type: Boolean },
asset : {
name: String,
type: String // uh oh, it broke. asset will be interpreted as String
}
});

new Schema({
works: { type: Boolean }
, asset : {
name: String
, type: { type: String } // works. asset is an object with a type property
}
works: { type: Boolean },
asset : {
name: String,
type: { type: String } // works. asset is an object with a type property
}
});
```

Expand Down
1 change: 0 additions & 1 deletion test/docs/promises.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var PromiseProvider = require('../../lib/promise_provider');
var assert = require('assert');
var async = require('async');
var mongoose = require('../../');

describe('promises docs', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2072,7 +2072,7 @@ describe('document', function() {
var axl = new Person({ name: 'Axl Rose' });
var gnr = new Band({ leadSinger: axl });

gnr.save(function(error, doc) {
gnr.save(function(error) {
assert.ifError(error);
assert.equal(gnr.leadSinger.name, 'Axl Rose');
db.close(done);
Expand Down
14 changes: 7 additions & 7 deletions test/model.findOneAndUpdate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1481,9 +1481,9 @@ describe('model: findByIdAndUpdate:', function() {
var db = start();
var recordSchema = new mongoose.Schema({
kind: String,
amount: Number,
amount: Number
}, {
_id: false,
_id: false
});

var shiftSchema = new mongoose.Schema({
Expand All @@ -1495,14 +1495,14 @@ describe('model: findByIdAndUpdate:', function() {

Shift.create({
userId: 'tom',
records: [],
}, function(error, shift) {
records: []
}, function(error) {
assert.ifError(error);
Shift.findOneAndUpdate({userId: 'tom'}, {
records: [{kind: 'kind1', amount: NaN}],
records: [{kind: 'kind1', amount: NaN}]
}, {
'new': true,
}, function(error, shift) {
'new': true
}, function(error) {
assert.ok(error);
assert.ok(error instanceof CastError);
db.close(done);
Expand Down
2 changes: 1 addition & 1 deletion test/model.populate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe('model: populate:', function() {
Application.
findById(id).
populate([
{ path: 'tasks', populate: { path: 'handler' } },
{ path: 'tasks', populate: { path: 'handler' } }
]).
exec(function(error, doc) {
assert.ifError(error);
Expand Down

0 comments on commit aac346a

Please sign in to comment.