Tag: mongoose should.js

使用ShouldJS比较来自Mongoose的数组

把一个数组(如'hello','there')存储在Mongoose文档中, tags: { type: Array } 使用诸如: Something.create({ tags: ['hello', 'there']}, cb); 然后使用ShouldJS来检查文档是否符合我提供的数组,我期望这一点: doc.tags.should.eql(['hello', 'there']); 但事实并非如此。 如果我console.log doc标签我得到: [hello, there] 请注意,报价已经消失。 doc.tags确实是一个数组(我可以检查instanceof数组),我也可以使用shouldjs doc.tags.should.have.keys('hello'); doc.tags.should.have.keys('there'); 任何人有一个想法,为什么我的arrays不匹配了?