Skip to content

Instantly share code, notes, and snippets.

Dana Groce danared

  • MongoDB
Block or report user

Report or block danared

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5a98a10ff22c964b0afa
{ "_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"
}
View gist:af851b70e9bf2dfebde7
{
"_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"
View gist:6b3798cb746bc200f1bc
{
"_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"
View gist:4836ffe1bc7985bf1753
class Product {
String productName;
List<Features> ff;
Date introDate;
List<Date> versDates;
int[] unitBundles;
//…
}
View gist:82c862d49e268385378b
<product>
<name>widget1</name>
<features>
<feature>
<text>good texture</text>
<type>A</type>
</feature>
</features>
<introDate>20140204</introDate>
<versDates>
View gist:47ee8953682e5996abe9
<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” …
View gist:ae8edff29e361f271da9
{
result: { ok: 1, n: 1 },
connection: … Connection executed against …,
}
View gist:7c57f82ef6941f8ef45a
mkdir myprojects
cd myprojects
npm init
npm install mongodb --save
View gist:46f3bfbf824ec0e585b9
{
result: { ok: 1, n: 1 },
connection: … Connection executed against …,
ops: [... Array of documents inserted ...]
}
```
#### Update 2.0 return value
```
{
View gist:be8b2b5f8613b5a17dac
var updates = { $unset: { steak: true }, $set: { eggs: 0 } };
// Note the `runValidators` option
Breakfast.update({}, updates, { runValidators: true }, function(err) {
console.log(err.errors['steak'].message);
console.log(err.errors['eggs'].message);
/*
* The above error messages output:
* "Path `steak` is required."
* "Path `eggs` (0) is less than minimum allowed value (2)."
*/
You can’t perform that action at this time.