This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id" : ObjectId("5063114bd386d8fadbd6b004"), | |
"name" : "Brian D. Goodman", | |
"organizations" : ["MongoDB"], | |
"locations" : [ | |
{ "type" : "work", | |
"address" : "229 W 34 St., 5th floor", | |
"city" : "New York", | |
"state" : "NY", | |
"zipcode" : "10036" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id" : ObjectId("5063114bd386d8fadbd6b004"), | |
"name" : "Brian D. Goodman", | |
"organizations" : ["MongoDB"], | |
"locations" : [ | |
{ "type" : "work", | |
"address" : "229 W 34 St., 5th floor", | |
"city" : "New York", | |
"state" : "NY", | |
"zipcode" : "10036" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product { | |
String productName; | |
List<Features> ff; | |
Date introDate; | |
List<Date> versDates; | |
int[] unitBundles; | |
//… | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<product> | |
<name>widget1</name> | |
<features> | |
<feature> | |
<text>good texture</text> | |
<type>A</type> | |
</feature> | |
</features> | |
<introDate>20140204</introDate> | |
<versDates> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p name=“widget1” ftxt1=“good texture” ftyp1=“A” idt=“20140203” … | |
<p name=“widget2” ftxt1=“not fragile” ftyp1=“A” idt=“20110117” … | |
<p name=“widget3” ftxt1=“dense” idt=“20140203” … | |
<p name=“widget4” idt=“20140203” versD=“20130403,20130104,20100605” … |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
result: { ok: 1, n: 1 }, | |
connection: … Connection executed against …, | |
ops: [... Array of documents inserted ...] | |
} | |
``` | |
#### Update 2.0 return value | |
``` | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
result: { ok: 1, n: 1 }, | |
connection: … Connection executed against …, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir myprojects | |
cd myprojects | |
npm init | |
npm install mongodb --save |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var breakfastSchema = new mongoose.Schema({ | |
steak: { | |
type: String, | |
required: true, | |
enum: ['flank', 'ribeye'] | |
}, | |
eggs: { | |
type: Number, | |
required: true, | |
min: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var updates = { $unset: { steak: true }, $set: { eggs: 0 } }; | |
Breakfast.update({}, updates, callback); |