You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
60
+
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`.
61
61
62
62
**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._
63
63
@@ -68,14 +68,14 @@ Once connected, the `open` event is fired on the `Connection` instance. If you'r
68
68
Models are defined through the `Schema` interface.
69
69
70
70
```js
71
-
var Schema =mongoose.Schema
72
-
, ObjectId =Schema.ObjectId;
71
+
var Schema =mongoose.Schema,
72
+
ObjectId =Schema.ObjectId;
73
73
74
74
var BlogPost =newSchema({
75
-
author : ObjectId
76
-
, title :String
77
-
, body :String
78
-
, date :Date
75
+
author : ObjectId,
76
+
title :String,
77
+
body :String,
78
+
date :Date
79
79
});
80
80
```
81
81
@@ -96,11 +96,11 @@ The following example shows some of these features:
96
96
97
97
```js
98
98
varComment=newSchema({
99
-
name : { type:String, default:'hahaha' }
100
-
, age : { type:Number, min:18, index:true }
101
-
, bio : { type:String, match:/[a-z]/ }
102
-
, date : { type:Date, default:Date.now }
103
-
, buff : Buffer
99
+
name : { type:String, default:'hahaha' },
100
+
age : { type:Number, min:18, index:true },
101
+
bio : { type:String, match:/[a-z]/ },
102
+
date : { type:Date, default:Date.now },
103
+
buff : Buffer
104
104
});
105
105
106
106
// a setter
@@ -269,19 +269,19 @@ Moreover, you can mutate the incoming `method` arguments so that subsequent midd
269
269
270
270
```js
271
271
newSchema({
272
-
broken: { type:Boolean }
273
-
, asset : {
274
-
name:String
275
-
, type:String// uh oh, it broke. asset will be interpreted as String
272
+
broken: { type:Boolean },
273
+
asset : {
274
+
name:String,
275
+
type:String// uh oh, it broke. asset will be interpreted as String
276
276
}
277
277
});
278
278
279
279
newSchema({
280
-
works: { type:Boolean }
281
-
, asset : {
282
-
name:String
283
-
, type: { type:String } // works. asset is an object with a type property
284
-
}
280
+
works: { type:Boolean },
281
+
asset : {
282
+
name:String,
283
+
type: { type:String } // works. asset is an object with a type property
0 commit comments