Skip to content

Commit

Permalink
Merge pull request #1 from Automattic/master
Browse files Browse the repository at this point in the history
Update from original
  • Loading branch information
JT authored Jan 4, 2017
2 parents 8c45879 + 344a2b7 commit 7c5c946
Show file tree
Hide file tree
Showing 85 changed files with 10,074 additions and 6,151 deletions.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- *Before creating an issue please make sure you are using the latest version of mongoose -->

**Do you want to request a *feature* or report a *bug*?**

**What is the current behavior?**

**If the current behavior is a bug, please provide the steps to reproduce.**
<!-- If you can, provide a stadalone script / gist to reproduce your issue -->

**What is the expected behavior?**

**Please mention your node.js, mongoose and MongoDB version.**
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->

**Summary**

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

**Test plan**

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: node_js
sudo: false
node_js:
- "7"
- "6"
- "5"
- "4"
Expand Down
172 changes: 172 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,175 @@
4.7.6 / 2017-01-02
==================
* fix(model): allow passing non-array to insertMany #4846
* fix(populate): use base model name if no discriminator for backwards compat #4843
* fix: allow internal validate callback to be optional #4842 [arciisine](https://github.com/arciisine)
* fix(document): don't skip pointCut if save not defined (like in browser doc) #4841
* chore: improve benchmarks #4838 [billouboq](https://github.com/billouboq)
* perf: remove some unused parameters #4837 [billouboq](https://github.com/billouboq)
* fix(query): don't call error handler if passRawResult is true and no error occurred #4836

4.7.5 / 2016-12-26
==================
* docs(model): fix spelling mistake #4828 [paulinoj](https://github.com/paulinoj)
* fix(aggregate): remove unhandled rejection when using aggregate.then() #4824
* perf: remove try/catch that kills optimizer #4821
* fix(model): handles populating with discriminators that may not have a ref #4817
* fix(document): handle setting array of discriminators #3575

4.7.4 / 2016-12-21
==================
* docs: fix typo #4810 [GEEKIAM](https://github.com/GEEKIAM)
* fix(query): timestamps with $push + $each #4805
* fix(document): handle buffers correctly in minimize #4800
* fix: don't disallow overwriting default and cast fns #4795 [pdspicer](https://github.com/pdspicer)
* fix(document): don't convert single nested docs to POJOs #4793
* fix(connection): handle reconnect to replica set correctly #4972 [gfzabarino](https://github.com/gfzabarino)

4.7.3 / 2016-12-16
==================
* fix: upgrade mongodb driver -> 2.2.16 for several bug fixes and 3.4 support #4799
* fix(model): ensure discriminator key is correct for child schema on discriminator #4790
* fix(document): handle mark valid in subdocs correctly #4778
* fix(query): check for objects consistently #4775

4.7.2 / 2016-12-07
==================
* test(populate): fix justOne test #4772 [cblanc](https://github.com/cblanc)
* chore: fix benchmarks #4769 [billouboq](https://github.com/billouboq)
* fix(document): handle setting subdoc to null after setting parent doc #4766
* fix(query): support passRawResult with lean #4762 #4761 [mhfrantz](https://github.com/mhfrantz)
* fix(query): throw StrictModeError if upsert with nonexisting field in condition #4757
* test: fix a couple of sort tests #4756 [japod](https://github.com/japod)
* chore: upgrade mongodb driver -> 2.2.12 #4753 [mdlavin](https://github.com/mdlavin)
* fix(query): handle update with upsert and overwrite correctly #4749

4.7.1 / 2016-11-30
==================
* fix(schema): throw error if you use prototype as a schema path #4746
* fix(schema): throw helpful error if you define a virtual with the same path as a real path #4744
* fix(connection): make createConnection not throw rejected promises #4742
* fix(populate): allow specifiying options in model schema #4741
* fix(document): handle selected nested elements with defaults #4739
* fix(query): add model to cast error if possible #4729
* fix(query): handle timestamps with overwrite #4054

4.7.0 / 2016-11-23
==================
* docs: clean up schematypes #4732 [kidlj](https://github.com/kidlj)
* perf: only get stack when necessary with VersionError #4726 [Sebmaster](https://github.com/Sebmaster)
* fix(query): ensure correct casting when setting array element #4724
* fix(connection): ensure db name gets set when you pass 4 params #4721
* fix: prevent TypeError in node v7 #4719 #4706
* feat(document): support .set() on virtual subpaths #4716
* feat(populate): support populate virtuals on nested schemas #4715
* feat(querycursor): support transform option and .map() #4714 #4705 [cblanc](https://github.com/cblanc)
* fix(document): dont set defaults on not-selected nested paths #4707
* fix(populate): don't throw if empty string passed to populate #4702
* feat(model): add `loadClass()` function for importing schema from ES6 class #4668 [rockmacaca](https://github.com/rockmacaca)

4.6.8 / 2016-11-14
==================
* fix(querycursor): clear stack when iterating onto next doc #4697
* fix: handle null keys in validation error #4693 #4689 [arciisine](https://github.com/arciisine)
* fix(populate): handle pre init middleware correctly with populate virtuals #4683
* fix(connection): ensure consistent return value for open and openSet #4659
* fix(schema): handle falsy defaults for arrays #4620

4.6.7 / 2016-11-10
==================
* fix(document): only invalidate in subdoc if using update validators #4681
* fix(document): don't create subdocs when excluded in projection #4669
* fix(document): ensure single embedded schema validator runs with correct context #4663
* fix(document): make sure to depopulate top level for sharding #4658
* fix(connection): throw more helpful error when .model() called incorrectly #4652
* fix(populate): throw more descriptive error when trying to populate a virtual that doesn't have proper options #4602
* fix(document): ensure subtype gets set properly when saving with a buffer id #4506
* fix(query): handle setDefaultsOnInsert with defaults on doc arrays #4456
* fix(drivers): make debug output better by calling toBSON() #4356

4.6.6 / 2016-11-03
==================
* chore: upgrade deps #4674 [TrejGun](https://github.com/TrejGun)
* chore: run tests on node v7 #4673 [TrejGun](https://github.com/TrejGun)
* perf: make setDefaultsOnInsert more efficient if upsert is off #4672 [CamHenlin](https://github.com/CamHenlin)
* fix(populate): ensure document array is returned #4656
* fix(query): cast doc arrays with positionals correctly for update #4655
* fix(document): ensure single nested doc validators run with correct context #4654
* fix: handle reconnect failed error in new version of driver #4653 [loris](https://github.com/loris)
* fix(populate): if setting a populated doc, take its id #4632
* fix(populate): handle populated virtuals in init #4618

4.6.5 / 2016-10-23
==================
* docs: fix grammar issues #4642 #4640 #4639 [silvermanj7](https://github.com/silvermanj7)
* fix(populate): filter out nonexistant values for dynref #4637
* fix(query): handle $type as a schematype operator #4632
* fix(schema): better handling for uppercase: false and lowercase: false #4622
* fix(query): don't run transforms on updateForExec() #4621
* fix(query): handle id = 0 in findById #4610
* fix(query): handle buffers in mergeClone #4609
* fix(document): handle undefined with conditional validator for validateSync #4607
* fix: upgrade to mongodb driver 2.2.11 #4581
* docs(schematypes): clarify schema.path() #4518
* fix(query): ensure path is defined before checking in timestamps #4514
* fix(model): set version key in upsert #4505
* fix(document): never depopulate top-level doc #3057
* refactor: ensure sync for setting non-capped collections #2690

4.6.4 / 2016-10-16
==================
* fix(query): cast $not correctly #4616 #4592 [prssn](https://github.com/prssn)
* fix: address issue with caching global plugins #4608 #4601 [TrejGun](https://github.com/TrejGun)
* fix(model): make sure to depopulate in insertMany #4590
* fix(model): buffer autoIndex if bufferCommands disabled #4589
* fix(populate): copy ids array before modifying #4585
* feat(schema): add retainKeyOrder prop #4542
* fix(document): return isModified true for children of direct modified paths #4528
* fix(connection): add dropDatabase() helper #4490
* fix(model): add usePushEach option for schemas #4455
* docs(connections): add some warnings about buffering #4413
* fix: add ability to set promise implementation in browser #4395

4.6.3 / 2016-10-05
==================
* fix(document): ensure single nested docs get initialized correctly when setting nested paths #4578
* fix: turn off transforms when writing nested docs to db #4574
* fix(document): don't set single nested subdocs to null when removing parent doc #4566
* fix(model): ensure versionKey gets set in insertMany #4561
* fix(schema): handle typeKey in arrays #4548
* feat(schema): set $implicitlyCreated on schema if created by interpretAsType #4443

4.6.2 / 2016-09-30
==================
* chore: upgrade to async 2.0.1 internally #4579 [billouboq](https://github.com/billouboq)
* fix(types): ensure nested single doc schema errors reach update validators #4557 #4519
* fix(connection): handle rs names with leading numbers (muri 1.1.1) #4556
* fix(model): don't throw if method name conflicts with Object.prototype prop #4551
* docs: fix broken link #4544 [VFedyk](https://github.com/VFedyk)
* fix: allow overwriting model on mongoose singleton #4541 [Nainterceptor](https://github.com/Nainterceptor)
* fix(document): don't use init: true when building doc defaults #4540
* fix(connection): use replSet option if replset not specified #4535
* fix(query): cast $not objects #4495

4.6.1 / 2016-09-20
==================
* fix(query): improve handling of $not with $elemMatch #4531 #3719 [timbowhite](https://github.com/timbowhite)
* fix: upgrade mongodb -> 2.2.10 #4517
* chore: fix webpack build issue #4512 [saiichihashimoto](https://github.com/saiichihashimoto)
* fix(query): emit error on next tick when exec callback errors #4500
* test: improve test case #4496 [isayme](https://github.com/isayme)
* fix(schema): use same check for array types and top-level types #4493
* style: fix indentation in docs #4489 [dhurlburtusa](https://github.com/dhurlburtusa)
* fix(schema): expose original object passed to constructor #4486
* fix(query): handle findOneAndUpdate with array of arrays #4484 #4470 [fedotov](https://github.com/fedotov)
* feat(document): add $ignore to make a path ignored #4480
* fix(query): properly handle setting single embedded in update #4475 #4466 #4465
* fix(updateValidators): handle single nested schema subpaths correctly #4479
* fix(model): throw handy error when method name conflicts with property name #4475
* fix(schema): handle .set() with array field #4472
* fix(query): check nested path when avoiding double-validating Mixed #4441
* fix(schema): handle calling path.trim() with no args correctly #4042

4.6.0 / 2016-09-02
==================
* docs(document): clarify the findById and findByIdAndUpdate examples #4471 [mdcanham](https://github.com/mdcanham)
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

Mongoose is a [MongoDB](https://www.mongodb.org/) object modeling tool designed to work in an asynchronous environment.

[![Slack Status](http://slack.mongoosejs.io/badge.svg)](http://slack.mongoosejs.io)
[![Build Status](https://api.travis-ci.org/Automattic/mongoose.svg?branch=master)](https://travis-ci.org/Automattic/mongoose)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Automattic/mongoose?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![NPM version](https://badge.fury.io/js/mongoose.svg)](http://badge.fury.io/js/mongoose)
[![Dependency Status](https://gemnasium.com/Automattic/mongoose.svg)](https://gemnasium.com/Automattic/mongoose)
[![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/vkarpov?utm_source=github&utm_medium=button&utm_term=vkarpov&utm_campaign=github)

## Documentation

Expand All @@ -14,10 +15,10 @@ Mongoose is a [MongoDB](https://www.mongodb.org/) object modeling tool designed
## Support

- [Stack Overflow](http://stackoverflow.com/questions/tagged/mongoose)
- [bug reports](https://github.com/Automattic/mongoose/issues/)
- [help forum](http://groups.google.com/group/mongoose-orm)
- [MongoDB support](https://docs.mongodb.org/manual/support/)
- [Mongoose Slack Channel](https://mongoosejs.slack.com/)
- [Bug Reports](https://github.com/Automattic/mongoose/issues/)
- [Mongoose Slack Channel](http://slack.mongoosejs.io/)
- [Help Forum](http://groups.google.com/group/mongoose-orm)
- [MongoDB Support](https://docs.mongodb.org/manual/support/)

## Plugins

Expand All @@ -29,9 +30,6 @@ Build your own Mongoose plugin through [generator-mongoose-plugin](https://githu

View all 200+ [contributors](https://github.com/Automattic/mongoose/graphs/contributors). Stand up and be counted as a [contributor](https://github.com/Automattic/mongoose/blob/master/CONTRIBUTING.md) too!

## Live Examples
<a href="http://code.runnable.com/mongoose" target="_blank"><img src="http://i.imgur.com/4yNYDLI.png"></a>

## Installation

First install [node.js](http://nodejs.org/) and [mongodb](https://www.mongodb.org/downloads). Then:
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchjs/casting.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ suite.add('Casting - Embedded Docs - 0 Docs', {
out.ops = item.hz;
outObj[item.name.replace(/\s/g, '')] = out;
});
console.log(JSON.stringify(outObj));
console.dir(outObj, {depth: null, colors: true});
}
}).run({async: true});
4 changes: 2 additions & 2 deletions benchmarks/benchjs/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
nData.likes = data.likes;
nData.address = data.address;
user.insert(nData, function(err, res) {
dIds.push(res[0]._id);
dIds.push(res.insertedIds[0]);
--count || next();
});
}
Expand Down Expand Up @@ -120,7 +120,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
out.ops = item.hz;
outObj[item.name.replace(/\s/g, '')] = out;
});
console.log(JSON.stringify(outObj));
console.dir(outObj, {depth: null, colors: true});
}
});
function next() {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchjs/insert.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
out.ops = item.hz;
outObj[item.name.replace(/\s/g, '')] = out;
});
console.log(JSON.stringify(outObj));
console.dir(outObj, {depth: null, colors: true});
}
}).run({async: true});
});
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/benchjs/multiop.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
if (err) {
throw err;
}
dIds.push(res[0]._id);
dIds.push(res.insertedIds[0]);
--count || next();
});
BlogPost.create(blogData, function(err, bp) {
Expand All @@ -142,7 +142,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
if (err) {
throw err;
}
bdIds.push(res[0]._id);
bdIds.push(res.insertedIds[0]);
--count || next();
});
}
Expand Down Expand Up @@ -447,7 +447,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
out.ops = item.hz;
outObj[item.name.replace(/\s/g, '')] = out;
});
console.log(JSON.stringify(outObj));
console.dir(outObj, {depth: null, colors: true});
}
});
function next() {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchjs/population.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench-pop', function(err) {
out.ops = item.hz;
outObj[item.name.replace(/\s/g, '')] = out;
});
console.log(JSON.stringify(outObj));
console.dir(outObj, {depth: null, colors: true});
}
});
function next() {
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/benchjs/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
if (err) {
throw err;
}
dIds.push(res[0]._id);
dIds.push(res.insertedIds[0]);
--count || next();
});
BlogPost.create(blogData, function(err, bp) {
Expand All @@ -136,7 +136,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
if (err) {
throw err;
}
bdIds.push(res[0]._id);
bdIds.push(res.insertedIds[0]);
--count || next();
});
}
Expand Down Expand Up @@ -306,7 +306,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
out.ops = item.hz;
outObj[item.name.replace(/\s/g, '')] = out;
});
console.log(JSON.stringify(outObj));
console.dir(outObj, {depth: null, colors: true});
}
});
function next() {
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/benchjs/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
});
var nData = utils.clone(data);
user.insert(nData, function(err, res) {
dIds.push(res[0]._id);
dIds.push(res.insertedIds[0]);
--count || next();
});
BlogPost.create(blogData, function(err, bp) {
Expand All @@ -132,7 +132,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
if (err) {
throw err;
}
bdIds.push(res[0]._id);
bdIds.push(res.insertedIds[0]);
--count || next();
});
}
Expand Down Expand Up @@ -329,7 +329,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function(err) {
out.ops = item.hz;
outObj[item.name.replace(/\s/g, '')] = out;
});
console.log(JSON.stringify(outObj));
console.dir(outObj, {depth: null, colors: true});
}
});
function next() {
Expand Down
Loading

0 comments on commit 7c5c946

Please sign in to comment.