Hey Aaron, here's the error I get + stack trace:
-------------------------------------------------------------------
Error: invalid query
at Promise.error (/git/smiley/node/beta/node_modules/mongoose/lib/promise.js:80:38)
at cb (/git/smiley/node/beta/node_modules/mongoose/lib/query.js:912:29)
at /git/smiley/node/beta/node_modules/mongoose/lib/utils.js:408:16
at /git/smiley/node/beta/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:124:30
at /git/smiley/node/beta/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:166:32
at /git/smiley/node/beta/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:441:39
at Cursor.close (/git/smiley/node/beta/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:687:5)
at [object Object].<anonymous> (/git/smiley/node/beta/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:441:21)
at [object Object].g (events.js:156:14)
at [object Object].emit (events.js:88:20)
Here's my schema:
-------------------------------------------------------------------
userSchema = new Schema
shortId:
type: String
unique: true
required: true
name:
first:
type: String
required: true
last:
type: String
required: true
email:
type: String
unique: true
required: true
password:
salt:
type: String
required: true
hash:
type: String
required: true
stats:
lastLogin:
type: Date
loginCount:
type: Number
archive:
type: Boolean
default: null
Also fwiw, here's what my query object looks like before passing it to schema.find:
-------------------------------------------------------------------
{ options: { populate: {} },
safe: undefined,
_conditions: { archive: { '$in': [Object] } },
model:
{ [Function: model]
modelName: 'user',
findByShortId: [Function],
archiveByShortId: [Function],
authenticate: [Function] },
op: 'find',
_currPath: 'archive' }
Let me know if there's anything else I should provide, I'd be glad to.
I hadn't tried .ne(true), and it does give the desired result, but you say it won't utilize indices. I'm totally new to mongoose and mongo, can you point me to where this is explained in the docs (if it is)?
Also, on chaining .equals() ... it was pretty clear what was happening by inspecting the query object, so no worries, not too confusing ... In the docs there's an example that chains together .lte and .gte, so I was sorta crossing my fingers anyway when I tried chaining .equals :)