Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

docs

  • Loading branch information...
commit 42ed1e19d505f4a3f1b64df5e4a7b95d39c34031 1 parent df987f0
@aheckmann aheckmann authored
Showing with 57 additions and 16 deletions.
  1. +9 −7 README.md
  2. +1 −0  lib/document.js
  3. +47 −9 lib/types/array.js
View
16 README.md
@@ -289,9 +289,10 @@ You can find the [Dox](http://github.com/visionmedia/dox) generated API docs [he
## Getting support
-Please subscribe to the Google Groups [mailing list](http://groups.google.com/group/mongoose-orm).
-
-Join #mongoosejs on freenode.
+- Google Groups [mailing list](http://groups.google.com/group/mongoose-orm)
+- (irc) #mongoosejs on freenode
+- reporting [issues](https://github.com/learnboost/mongoose/issues/)
+- [10gen](http://www.mongodb.org/display/DOCS/Technical+Support)
## Driver access
@@ -305,13 +306,14 @@ Take a peek at the [plugins search site](http://plugins.mongoosejs.com/) to see
### Cloning the repository
-Make a fork of `mongoose`, then clone it in your computer. The `v2.x` branch contains the current stable release, and the `master` branch the next upcoming major release.
+Make a fork of `mongoose`, then clone it in your computer. The `v3.x` branch is for v3 development, the `v2.x` branch is for v2 development, and the `master` branch the next upcoming major release.
### Guidelines
-- Please write inline documentation for new methods or class members.
-- Please write tests and make sure your tests pass.
-- Before starting to write code, look for existing tickets or create one for your specific issue (unless you're addressing something that's clearly broken). That way you avoid working on something that might not be of interest or that has been addressed already in a different branch.
+- Before starting to write code, look for existing [tickets](https://github.com/learnboost/mongoose/issues) or [create one](https://github.com/learnboost/mongoose/issues/new) for your specific issue. That way you avoid working on something that might not be of interest or that has been addressed already in a different branch.
+- Write inline documentation for new methods or class members.
+- Write tests and make sure they pass.
+- Follow the general coding style of the rest of the project (comma first, etc).
## Credits
View
1  lib/document.js
@@ -694,6 +694,7 @@ Document.prototype.modifiedPaths = function () {
* ####Example
*
* doc.set('documents.0.title', 'changed');
+ * doc.isModified() // true
* doc.isModified('documents') // true
* doc.isModified('documents.0.title') // true
* doc.isDirectModified('documents') // false
View
56 lib/types/array.js
@@ -12,7 +12,7 @@ var ObjectId = require('./objectid');
*
* ####NOTE:
*
- * Values always have to be passed to the constructor to initialize, otherwise `MongooseArray#push` will mark the array as modified.
+ * _Values always have to be passed to the constructor to initialize, otherwise `MongooseArray#push` will mark the array as modified._
*
* @param {Array} values
* @param {String} path
@@ -198,7 +198,7 @@ MongooseArray.prototype.push = function () {
*
* ####NOTE:
*
- * marks the _entire_ array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._
+ * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._
*
* @param {any} [args...]
* @api public
@@ -217,7 +217,26 @@ MongooseArray.prototype.nonAtomicPush = function () {
* #### NOTE:
*
* _Calling this mulitple times on an array before saving sends the same command as calling it once._
- * _This update is implemented using the MongoDB [$pop](http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop) method._
+ * _This update is implemented using the MongoDB [$pop](http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop) method which enforces this restriction._
+ *
+ * doc.array = [1,2,3];
+ *
+ * var popped = doc.array.$pop();
+ * console.log(popped); // 3
+ * console.log(doc.array); // [1,2]
+ *
+ * // no affect
+ * popped = doc.array.$pop();
+ * console.log(doc.array); // [1,2]
+ *
+ * doc.save(function (err) {
+ * if (err) return handleError(err);
+ *
+ * // we saved, now $pop works again
+ * popped = doc.array.$pop();
+ * console.log(popped); // 2
+ * console.log(doc.array); // [1]
+ * })
*
* @api public
* @method $pop
@@ -240,7 +259,7 @@ MongooseArray.prototype.$pop = function () {
*
* ####Note:
*
- * marks the _entire_ array as modified which will pass the entire thing to $set potentially overwritting any changes that happen between when you retrieved the object and when you save it.
+ * _marks the entire array as modified which will pass the entire thing to $set potentially overwritting any changes that happen between when you retrieved the object and when you save it._
*
* @see MongooseArray#$pop #types_array_MongooseArray-%24pop
* @api public
@@ -258,7 +277,26 @@ MongooseArray.prototype.pop = function () {
* ####NOTE:
*
* _Calling this mulitple times on an array before saving sends the same command as calling it once._
- * _This update is implemented using the MongoDB [$pop](http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop) method._
+ * _This update is implemented using the MongoDB [$pop](http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop) method which enforces this restriction._
+ *
+ * doc.array = [1,2,3];
+ *
+ * var shifted = doc.array.$shift();
+ * console.log(shifted); // 1
+ * console.log(doc.array); // [2,3]
+ *
+ * // no affect
+ * shifted = doc.array.$shift();
+ * console.log(doc.array); // [2,3]
+ *
+ * doc.save(function (err) {
+ * if (err) return handleError(err);
+ *
+ * // we saved, now $shift works again
+ * shifted = doc.array.$shift();
+ * console.log(shifted ); // 2
+ * console.log(doc.array); // [3]
+ * })
*
* @api public
* @memberOf MongooseArray
@@ -288,7 +326,7 @@ MongooseArray.prototype.$shift = function $shift () {
*
* ####Note:
*
- * marks the _entire_ array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it.
+ * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._
*
* @api public
*/
@@ -360,7 +398,7 @@ MongooseArray.prototype.pull = function () {
*
* ####Note:
*
- * marks the _entire_ array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it.
+ * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._
*
* @api public
*/
@@ -378,7 +416,7 @@ MongooseArray.prototype.splice = function () {
*
* ####Note:
*
- * marks the _entire_ array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it.
+ * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._
*
* @api public
*/
@@ -395,7 +433,7 @@ MongooseArray.prototype.unshift = function () {
*
* ####NOTE:
*
- * marks the _entire_ array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it.
+ * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._
*
* @api public
*/
Please sign in to comment.
Something went wrong with that request. Please try again.