These are chat archives for Automattic/mongoose

Feb 2016
Diego Aguilar Aguilar
Feb 23 2016 06:58
@vkarpov15 I need Schema aditions on the go, like some schemas might get some extra required fields (I can't know which) according to the running app, I've thought maybe something like fixtures might help me
any suggestion?
also, I've thought, as I'm usng config module ( maybe I can merge objects into the object within the schema creation
Samuel Marks
Feb 23 2016 09:02
How to specify --authenticationDatabase in mongoose?
Feb 23 2016 17:21
This message was deleted
Feb 23 2016 17:26

guys I'm trying to do a simple query on an array of embedded docs:

var schema = new Schema{
    registrationNumber:[{ number: Number, year: Number,suffix:Number}],

my route

router.get('/', function(req,res) {
    var query = JSON.parse(req.query.q)
    model.find(query, function(err,data){
        if(err) console.log(err)


my request


what am I doing wrong?
Searching around it's possible query an array like this

James Lee
Feb 23 2016 17:54
it should be, can you show us the output of console.log(query)
Feb 23 2016 18:01
console.log(query) -> { 'registrationNumber.number': '1990' }

console.log(req.query.q) -> {"registrationNumber.number":"1990"}

Using JSON.parse(req.query.q) I get an empty array as response
Without JSON.parse I get the whole collection.

maybe the problem is the fields are defined as number?