Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add failing test for $in queries on mixed types

  • Loading branch information...
commit 99bf835b50bca8b81ad7aa0f806588befdca2cd5 1 parent 45aac40
@aheckmann aheckmann authored
Showing with 23 additions and 1 deletion.
  1. +23 −1 test/query.test.js
View
24 test/query.test.js
@@ -3,7 +3,17 @@
* Module dependencies.
*/
-var Query = require('mongoose/query');
+var Query = require('mongoose/query')
+ , start = require('./common')
+ , mongoose = start.mongoose
+ , DocumentObjectId = mongoose.Types.ObjectId
+ , Schema = mongoose.Schema
+
+var Product = new Schema({
+ tags: {} // mixed
+});
+
+mongoose.model('Product', Product);
/**
* Test.
@@ -525,6 +535,18 @@ module.exports = {
threw.should.eql(false);
},
+ 'test casting an array set to mixed type works': function () {
+ var query = new Query();
+ var db = start();
+ var Product = db.model('Product');
+ var params = { _id: new DocumentObjectId, tags: { $in: [ 4, 8, 15, 16 ] }};
+
+ query.cast(Product, params);
+
+ params.tags.$in.should.eql([4,8,15,16]);
+ db.close();
+ },
+
// Advanced Query options
'test Query#maxscan': function () {
Please sign in to comment.
Something went wrong with that request. Please try again.