These are chat archives for Automattic/mongoose

Mar 2016
Mar 25 2016 02:13
@wfhio _id is just an unique id, it could be a String or a Number too.
@saurabhvyas have you tried
results = memory.find( { 'metadata.itemcount': 0 }});
guys maybe someone could help here?
Basically I have to model the 'law' collection in chapters and paragraphs. The 'document' collection could have a ref to a chapter or a paragraph. I simply need a method to get all the documents that refs to the X chapter (and its paragraphs too!)
Mar 25 2016 07:41

Hi there, i have question about population.
My model looks like that:

var ListItemSchema = new mongoose.Schema({
    date:{ type: Date, default: },
    postedBy: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User'
    product: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Product'
    qty: { type: Number, max: 100 }

So why aint getting postedBy model populated, while running this query:

            .find({'$where': ', 10) == "'+d+'"'})
            .exec(function (error, products) {
                    if (error) {
                    return handleError(error);
                else {
                    return res.status(200).json({products: products})
Mar 25 2016 12:35
To answer myself if someone would need:
var populateQuery = [
            {path: 'product', select: 'name price'},
            {path: 'postedBy', select: 'email first_name last_name'}

        ListItem.find({'$where': ', 10) == "' + d + '"'})
Erinç Fırtına
Mar 25 2016 13:30
how can i validate embeded document field value by field which from parent document?
I tried this.parent(), this.parentArray() but did not work.
Richard Brookfield
Mar 25 2016 13:38
Quick question. I am working with mongos shards and looking to have auto-failover. Is this a valid configuration (seems to work)
var config = {
mongos: {
        ssl: true,
        sslCA: certFile
mongoose.connect(uri, config);
Erinç Fırtına
Mar 25 2016 14:05
@dvideby0 if your uri is correct it will work :)
Richard Brookfield
Mar 25 2016 14:06
awesome thank you.. the uri is comma separated URIs similar to how you would specify replica sets.. Is that still ok too? @EricMcRay
and thanks for the quick response too
Mar 25 2016 16:19
/join #golang