Permalink
Browse files

use mquery public selection methods

  • Loading branch information...
1 parent e324846 commit 39a4bc0227748ea555ddfe500252dd24baff2ffb Aaron Heckmann committed Jan 9, 2014
Showing with 31 additions and 12 deletions.
  1. +2 −2 lib/model.js
  2. +29 −10 lib/query.js
View
@@ -971,7 +971,7 @@ Model.find = function find (conditions, fields, options, callback) {
// get the raw mongodb collection object
var mq = new Query({}, options, this, this.collection);
mq.select(fields);
- if (this.schema.discriminatorMapping && mq._selectedInclusively()) {
+ if (this.schema.discriminatorMapping && mq.selectedInclusively()) {
mq.select(this.schema.options.discriminatorKey);
}
@@ -1076,7 +1076,7 @@ Model.findOne = function findOne (conditions, fields, options, callback) {
// get the mongodb collection object
var mq = new Query({}, options, this, this.collection);
mq.select(fields);
- if (this.schema.discriminatorMapping && mq._selectedInclusively()) {
+ if (this.schema.discriminatorMapping && mq.selectedInclusively()) {
mq.select(this.schema.options.discriminatorKey);
}
View
@@ -2812,21 +2812,40 @@ Query.prototype.centerSphere = function () {
}
/**
- * Determines if query fields are inclusive
+ * Determines if field selection has been made.
*
- * @return {Boolean} bool defaults to true
- * @api private
+ * @method selected
+ * @memberOf Query
+ * @return {Boolean}
+ * @api public
*/
-Query.prototype._selectedInclusively = Query.prototype.selectedInclusively;
-
-/*!
- * Remove from public api for 3.8
+/**
+ * Determines if inclusive field selection has been made.
+ *
+ * query.selectedInclusively() // false
+ * query.select('name')
+ * query.selectedInclusively() // true
+ *
+ * @method selectedInclusively
+ * @memberOf Query
+ * @return {Boolean}
+ * @api public
*/
-Query.prototype.selected =
-Query.prototype.selectedInclusively =
-Query.prototype.selectedExclusively = undefined;
+/**
+ * Determines if exclusive field selection has been made.
+ *
+ * query.selectedExclusively() // false
+ * query.select('-name')
+ * query.selectedExclusively() // true
+ * query.selectedInclusively() // false
+ *
+ * @method selectedExclusively
+ * @memberOf Query
+ * @return {Boolean}
+ * @api public
+ */
/*!
* Export

0 comments on commit 39a4bc0

Please sign in to comment.