<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.lang.javascript.mongoose">
    <title>gmane.comp.lang.javascript.mongoose</title>
    <link>http://blog.gmane.org/gmane.comp.lang.javascript.mongoose</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/637"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/632"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/611"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/607"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/604"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/602"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/593"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/591"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/589"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/588"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/584"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/582"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/578"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/576"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/573"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/566"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/565"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/561"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/560"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/552"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/637">
    <title>release 2.6.5</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/637</link>
    <description>&lt;pre&gt;2.6.5 / 2012-05-24
===================

  * fixed; do not save virtuals in Model.update (#894)
  * added; missing $ prefixed query aliases (going away in 3.x) (#884)
[timoxley]
  * fixed; setting invalid paths in strict mode (#916)
  * fixed; resetting isNew after insert failure (#837) [boutell]


&lt;/pre&gt;</description>
    <dc:creator>Aaron Heckmann</dc:creator>
    <dc:date>2012-05-24T20:33:14</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/632">
    <title>Save failing without error</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/632</link>
    <description>&lt;pre&gt;I have a model with a `index: {unique: true}`. The index is working and 
preventing duplicates in the database but I don't get an error when the 
save fails. What could cause this?

&lt;/pre&gt;</description>
    <dc:creator>Kevin Smith</dc:creator>
    <dc:date>2012-05-22T13:09:37</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/611">
    <title>Simple Unit Testing</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/611</link>
    <description>&lt;pre&gt;I would like to request some documentation be added to the public web page 
that explains the simplest setup for unit testing. Unit testing with 
Expresso and NodeUnit should be explained.

I tried to do this myself, but I was unsuccessful so far. By a simple setup 
I mean, create a test database do operations on it during one test case and 
then drop it. Currently we are using Expresso, but we are open to switching 
to NodeUnit.

&lt;/pre&gt;</description>
    <dc:creator>Michael Yagudaev</dc:creator>
    <dc:date>2012-05-20T21:54:48</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/607">
    <title>Creating a model interpretor</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/607</link>
    <description>&lt;pre&gt;Hello,

I'm writing an app that will translate a model definition for another
non-Node framework. I'm curious if I'm doing something wrong or if
there might be a bug in the latest build.

My app.js looks like so:

// Require global libraries
mongoose = require('mongoose');
config   = require('../../config.json');
require('./models.js');

// Require scoped libraries
var restify  = require('restify'),
app   = restify.createServer(config.api);

// General API router
app.get(
{ path: '/api/:parcel/:api_controller', version: '1.0.0' },
function(request, response, next) {
var controller = require(
'../' + request.params.parcel + '/api/' +
request.params.api_controller
);
controller.index(request, response, next);
response.end();
}
);
app.listen(3000);

My model class looks like:

Model = function(parcel, name) {

var model_name = name;
var schema     = null;
var parcel     = parcel;
var model      = null;
var db         = null;
var fields     = null;

this.init = function() {
// Get the model definition from the proper folder
var schema = require('../' + parcel + '/models/' + name + '.json');

// Establish the database connection for this class
db = mongoose.connect(
'mongodb://' + config.database.DB_HOST + '/' +
config.database.DB_NAME
);
console.log(this.convert_fields(schema.fields));
// Setup the mongoose model
model = db.model(
model_name,
new mongoose.Schema(this.convert_fields(schema.fields))
);
}

        // Translates the old schema definition to Mongoose friendly
schema
this.convert_fields = function(fields) {
var converted_fields = {};
for (var i in fields) {

converted_fields[i] = {};
converted_fields[i]['default'] = 'test';
converted_fields[i]['required'] = true;

// Convert the field types
switch (fields[i].type) {
case 'TEXT':
converted_fields[i].type = mongoose.Schema.Types.String;
break;
case 'DATE':
converted_fields[i].type = mongoose.Schema.Types.Date;
break;
case 'ENUM':
converted_fields[i].enum = fields[i].value.replace(/'/g,
'').split(',');
break;
case 'INT':
converted_fields[i].type = mongoose.Schema.Types.Number;
break;
}
}
return converted_fields;
}
}

It's throwing errors when trying to define a type, default, enum or
required at the schema level. The message I'm getting is: "Undefined
type at `email`\n Did you try nesting Schemas? You can only nest using
refs or arrays.". This happens when I'm throwing the fields into the
Schema class on:

new mongoose.Schema(this.convert_fields(schema.fields))

When I output converted_fields (the transformed model), I see it's
been generated correctly:

{
    email: {
        type: [Function: SchemaString]
    },
    first_name: {
        type: [Function: SchemaString]
    },
    last_name: {
        type: [Function: SchemaString]
    },
    password: {
        type: [Function: SchemaString]
    },
    status: {
        enum: ['active', 'inactive']
    },
    created_at: {
        type: [Function: SchemaDate]
    },
    updated_at: {
        type: [Function: SchemaDate]
    },
    last_login: {
        type: [Function: SchemaDate]
    }
}​

If I don't specify any properties for the fields, the model is setup
correctly.

Thanks,

Dave

&lt;/pre&gt;</description>
    <dc:creator>David D.</dc:creator>
    <dc:date>2012-05-20T19:57:33</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/604">
    <title>dup key MongoError: E11000 when trying to do an upsert</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/604</link>
    <description>&lt;pre&gt;I'm trying to perform an "upsert" by passing a raw json object to the constructor of a model object then invoke "save()".  The model is defined with a unique index on the "name" attribute, and the name attribute is required.  When I save a document I get the following error:
MongoError: E11000 duplicate key error index: db.users.organizations.$_id_  dup key: { : ObjectId('4fb846e3cfaa183b15000006') }

I think I'm probably using mongoose incorrectly.  Is save() supposed to figure out if the document should be updated or inserted?  Doesn't this error seem wrong?  

Is this how I should be doing an upsert?:

//assume I have some object like and it already exists in a collection
req.body = {
  '_id': '4fb846e3cfaa183b15000006'
  , 'name': 'David'
  , 'n_name': 'david'
  , 'other': 'other stuff'
};

// the utl.reject removes the '_id' and 'name' fields from the object(first arg)
var org = new Org(req.body, utl.reject(req.body, ['_id']));

org.save(function(err, m) {
  if (err) {   //error does occur here
    log.error(err.stack);
    callback(err, null);
  }
  else {
    log.debug(m + ' saved.');
    callback(null, m);
  }
});

This save call, when being invoked on an existing document throws the error below, however it works fine when creating a new document:

MongoError: E11000 duplicate key error index: db.users.organizations.$name_1  dup key: { : "a" }
        at Db.wrap (/Users/evadnoob/Projects/mtrxi/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1675:11)
        at [object Object].&amp;lt;anonymous&amp;gt; (/Users/evadnoob/Projects/mtrxi/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection.js:297:26)
        at [object Object].g (events.js:156:14)
        at [object Object].emit (events.js:88:20)
        at Db._callHandler (/Users/evadnoob/Projects/mtrxi/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1290:25)
        at /Users/evadnoob/Projects/mtrxi/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:329:30
        at [object Object].parseBody (/Users/evadnoob/Projects/mtrxi/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:118:5)
        at [object Object].&amp;lt;anonymous&amp;gt; (/Users/evadnoob/Projects/mtrxi/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:320:22)
        at [object Object].emit (events.js:67:17)
        at [object Object].&amp;lt;anonymous&amp;gt; (/Users/evadnoob/Projects/mtrxi/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:147:13)



I've tried removing the field name when saving, just as a test, and that obviously causes a problem in that the field 'name' is required.  I'd like to use the same "org.save" for both updates and inserts by passing raw json.  Is there a pattern for doing upsert with "save"?  I'd like to avoid doing Model.update(), since that apparently bypasses mongoose validation etc.  

Thanks, Dave 

&lt;/pre&gt;</description>
    <dc:creator>David Boon</dc:creator>
    <dc:date>2012-05-20T12:52:22</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/602">
    <title>Mongoose won't output Array in nested Schema</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/602</link>
    <description>&lt;pre&gt;Is there limit to how deep your objects can go in Mongoose?

[
{
  _id: 4fb073e2c11f3348c48857f3,
  name: 'Name',
  location: [
    {
      title: 'title',
      city: 'New York',
      country: 'United States',
      languages: [Object],  &amp;lt;&amp;lt;--- This should be a [String] like:
['English', 'Spanish', ...]
    }
  ]
},
{
  _id: 4fb073e2c11f3348c48857fc,
  name: 'Name',
  [...]
}
]
Not sure why the "languages" Array is outputting "[Object]" instead of
and Array of Strings. I've also notice that if I remove the "[]" and
just use a String data type in the Schema it outputs a comma delimited
list as a String

&lt;/pre&gt;</description>
    <dc:creator>pardoner</dc:creator>
    <dc:date>2012-05-20T05:15:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/593">
    <title>get the Model from the document instance?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/593</link>
    <description>&lt;pre&gt;Hey all,

I'm writing a plugin but I'd like it to be used when the name of the model
instance isn't known up front. that is, I'd like to be able to do something
like this:

function myPlugin(schema,opts){
  mySchema.add({..});
  mySchema.methods.someMethod = function(){
    // I want to retrieve the Model here from the "this" document
reference.
    // maybe something like...
    var MyModel = this.__proto__.model; // doesn't work :(
    var MyModel = mongoose.model(this.__proto__.modelName); // doesn't work
:(
  }
}

i know this is somewhat obscure but is this possible?

Best,
Victor

&lt;/pre&gt;</description>
    <dc:creator>Victor Powell</dc:creator>
    <dc:date>2012-05-18T20:25:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/591">
    <title>Universal statics for Schemas &amp; using JSON.stringify for search queries</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/591</link>
    <description>&lt;pre&gt;Hello all,

I have a question on how (if it's possible!) to attach a static method
to the Schema class directly, so that the same method would be
available on all models? For example, using the docs, could I do
something like

Schema.prototype.statics.search = function search (name, cb) {
  return this.where('name', new RegExp(name, 'i')).run(cb);
}

is there a way to make the 'search' method universal? So that whatever
model was initiated, the 'this' would apply to that model. Then I
could call

Animal.search('Rover', function (err) {
  if (err) ...
})

or

Alien.search('ET', function(err) {
}

and this would always produce the search Animal.where... or
Alien.where... I tried fiddling with Schema.prototype but I couldn't
get it to work.

Second question - if I do like so

var searchTerms = {};
searchTerms['name'] = 'Joe';

searchTerms = JSON.stringify(searchTerms);

Person.find(searchTerms, function(err, people) {...});

is returning all records, and not returning only docs with { 'name' :
'Joe'} ??

Much thanks!

&lt;/pre&gt;</description>
    <dc:creator>Petrov</dc:creator>
    <dc:date>2012-05-18T19:55:34</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/589">
    <title>returning values from nested functions in virtuals</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/589</link>
    <description>&lt;pre&gt;I have an Item schema and a User schema. Item has user as a referenced 
object. I want to retrieve the count of items the user owns. So I am 
creating a virtual like this

UserSchema
  .virtual('itemsCount')
  .get(function () {
    var count = 0
      , Item = mongoose.model('Item')

    Item.count({owner: this._id}, function (err, c) { count = c })

    return count
})

The problem I am facing here is, no matter what I do, count is always 0. I 
found a few questions&amp;lt;http://stackoverflow.com/questions/3373934/returning-values-from-nested-functions-in-javascript&amp;gt;similar to this on S.O, but there were no correct answers... I guess this 
is a typical async issue...

Any help appreciated...

&lt;/pre&gt;</description>
    <dc:creator>madhums</dc:creator>
    <dc:date>2012-05-18T05:25:15</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/588">
    <title>headed to jsconf.ar</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/588</link>
    <description>&lt;pre&gt;I'm headed to Argentina for jsconf. Anyone else?

&lt;/pre&gt;</description>
    <dc:creator>Aaron Heckmann</dc:creator>
    <dc:date>2012-05-17T14:06:30</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/584">
    <title>Should methods and statics be asynchronous or not and what are the implications?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/584</link>
    <description>&lt;pre&gt;I have defined a normalize method for a field in my Schema, so I have 
ASchema.methods.normalizeField = function () { 
  //normalize 
  return;
};

I'm wondering if it's bad that it is synchronous. More generally, what is 
the right way to think about these questions? I read everywhere that 
synchronous code blocks, and I can understand that in case of IO like 
reading files, streaming stuff, etc, but how about for a simple function 
like that? Does it block anything I'm not aware of?

Thanks a lot

&lt;/pre&gt;</description>
    <dc:creator>Stanislas Marion</dc:creator>
    <dc:date>2012-05-16T17:29:07</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/582">
    <title>Why doesn't MongooseJS correctly populate my fields?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/582</link>
    <description>&lt;pre&gt;I'm trying to adapt the example here

http://mongoosejs.com/docs/populate.html

I have removed stories and am trying to add a 'friends' field
instead.  My code is as follows

var PersonSchema = new Schema({
    name    : String
  , age     : Number
  , friends : [{ type: Schema.ObjectId, ref: 'Person' }]
});

var Person = mongoose.model('Person', PersonSchema);

var aaron = new Person({ name: 'Aaron', age: 100 });
var bill = new Person({ name: 'Bill', age: 97 });

aaron.save(function (err) {
    if (err) throw err;
    bill.save(function(err) {
        if (err) throw err;
        var charlie = new Person({ name: 'Charlie', age: 97, friends:
[aaron._id, bill._id] });
        charlie.save(function(err) {
            if (err) throw err;
            Person
            .findOne({name: 'Charlie'})
            .populate('friends')
            .run(function(err, friends) {
                if (err) throw err
                console.log('JSON for friends is: ', friends);
                db.disconnect();

            });

        });

    });

});

It prints out the following text

JSON for friends is:  { name: 'Charlie',
  age: 97,
  _id: 4fb302beb7ec1f775e000003,
  stories: [],
  friends:
   [ { name: 'Aaron',
       age: 100,
       _id: 4fb302beb7ec1f775e000001,
       stories: [],
       friends: [] },
     { name: 'Bill',
       age: 97,
       _id: 4fb302beb7ec1f775e000002,
       stories: [],
       friends: [] } ] }

In other words it is printing out the 'charlie' object.  My desired
functionality is for MongooseJS to use ObjectIds in the friends field
and populate an array with the matching objects (aaron and bill).  In
other words something more along the lines of

[ { name: 'Aaron',
       age: 100,
       _id: 4fb302beb7ec1f775e000001,
       stories: [],
       friends: [] },
     { name: 'Bill',
       age: 97,
       _id: 4fb302beb7ec1f775e000002,
       stories: [],
       friends: [] } ]

What am I doing wrong?

&lt;/pre&gt;</description>
    <dc:creator>Don Nguyen</dc:creator>
    <dc:date>2012-05-16T01:41:36</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/578">
    <title>plugins set to strict?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/578</link>
    <description>&lt;pre&gt;I noticed that when a plugin made that uses schema.add({...}) really weird
things happen plugin calls schema.add with {strict:true}. this was a bug in
my code because a plugin set to strict cant be extended and thus shouldn't
be a plugin but what do you think about adding a check to warn the user?
something along the lines of "Error: plugins cannot set the schema to
strict"

&lt;/pre&gt;</description>
    <dc:creator>Victor Powell</dc:creator>
    <dc:date>2012-05-15T20:29:12</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/576">
    <title>release 2.6.4</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/576</link>
    <description>&lt;pre&gt;2.6.4 / 2012-05-15
===================

    * updated; backport string regex $options to 2.x
    * updated; use driver 1.0.2 (performance improvements) (#914)
    * fixed; calling MongooseDocumentArray#id when the doc has no _id (#897)


&lt;/pre&gt;</description>
    <dc:creator>Aaron Heckmann</dc:creator>
    <dc:date>2012-05-15T18:49:15</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/573">
    <title>Mongoose failed to save model changes</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/573</link>
    <description>&lt;pre&gt;

I'm trying to update a user document in mongoose but I can't get it done. 
Here is my user model

var UserSchema = new Schema({
email : {
    type : String,
    unique : true
},
salt : {
    type : String,
    required : true
},
hash : {
    type : String,
    required : true
},
account_no : {
    type : String,
    required : true,
    unique : true
},
activate_until:{
    date:{ type: Date, default: Date.now }  
    },
    valid : {
        type : Boolean,
        required : false
    },
    reset_token:{
        type : String 
    },
    reset_until:{
        date:{ type: Date, default: Date.now }  
        }

    });

    UserSchema.virtual('password').get(function() {
        return this._password;
    }).set(function(password) {
        this._password = password;
        var salt = this.salt = bcrypt.genSaltSync(10);
        this.hash = bcrypt.hashSync(password, salt);

        this.account_no = generateAccountNo();
        this.activate_until=new Date();
        this.valid = false;
    });

now I'm trying to update user password using the following method

resetAccount: function(key,password, callback) {
        User.findOne({
            reset_token : key
        }, function(err, user) {
            if(err) {
                console.error(err);
                return callback(err);
            }
            if(!user) {
                console.log("not user");
                return callback("not user", false);
            }
            var salt = user.salt = bcrypt.genSaltSync(10);
            user.hash = bcrypt.hashSync(password, salt);
            console.log(user);

            var upsertData = user.toObject();

    // Delete the _id property, otherwise Mongo will return a "Mod on _id not allowed" error
    delete upsertData._id;

    console.log( user._id);

    // Do the upsert, which works like this: If no Contact document exists with
    // _id = contact.id, then create a new doc using upsertData.
    // Otherwise, update the existing doc with upsertData
    User.update({
        _id : user._id
    },{$set:{ salt:salt,hash:user.hash}}, {
        upsert : false
    }, function(err) {
        if(err) {
            console.error(err);
            callback(err);
        }
         return callback("Password changed", user);
    });

        // this.update({account_no:key}, { $set: { valid: false }},{ upsert: true }, //function(err, user) {
        // if (err) { console.log(err);return callback(err); }
        // if (!user) { return callback(null, false); }
        // console.log(this.email);
        // return callback(user,true);
        //
        // });
    });
    },

Is there something I missed that makes it not working?

Thanks, 

Feras

&lt;/pre&gt;</description>
    <dc:creator>Feras Odeh</dc:creator>
    <dc:date>2012-05-15T07:11:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/566">
    <title>Better approach for a text searching</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/566</link>
    <description>&lt;pre&gt;I have the documents like this:

    {
        _id: ObjectId(),
        name: 'Text'
    },
    {
        _id: ObjectId(),
        name: 'the text'
    },
    {
        _id: ObjectId(),
        name: 'the full text'
    }

How can I find all documents matching the following text 'text full'? 
Should I use regexp?

&lt;/pre&gt;</description>
    <dc:creator>Mario</dc:creator>
    <dc:date>2012-05-15T07:10:36</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/565">
    <title>Request for feedback on some mongoose 3.x changes</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/565</link>
    <description>&lt;pre&gt;I'm proposing some api changes for Mongoose 3.x and would love to hear
questions and feedback from everyone. Please leave your thoughts/concerns
on the pull request here: https://github.com/LearnBoost/mongoose/pull/831


&lt;/pre&gt;</description>
    <dc:creator>Aaron Heckmann</dc:creator>
    <dc:date>2012-05-14T19:50:13</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/561">
    <title>Help: Know when an item is added to set</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/561</link>
    <description>&lt;pre&gt;Hi guys, 

As per this bug &amp;lt;https://jira.mongodb.org/browse/SERVER-3409&amp;gt;, mongo itself 
doesn't have any kind of built-in mechanism for knowing if an item was 
actually added to a set or not :/

I need to fire events if items are added to a set, but I can't think of a 
"safe" way to do this since doing it in two queries (first checking if in 
set, then adding to set and firing the event if it wasn't already in the 
set) could lead to two processes (think node cluster) reporting that the 
item was not in the set.

There's this solution from 
https://groups.google.com/d/msg/mongodb-user/DPW90mH4-0k/yQGa42gl3-QJ:

db.foo.update({_id: 'some_id', array: {$ne: 'foo'}}, { $addToSet: { array: 
'foo' }}) 

But I can't seem to get the thing to run properly since it can't seem to 
find the document to update 

Group.update({_id: this._id, _users: {$ne: user._id}}, {$addToSet: {_users: 
user._id}}, callback) // never finds the document

while a similar query run in the mongo repl works just fine. 

The other downside is that it forces me to have explicit add/remove methods 
which is not ideal.

Any ideas?


&lt;/pre&gt;</description>
    <dc:creator>Tim Oxley</dc:creator>
    <dc:date>2012-05-13T20:27:11</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/560">
    <title>access to matched term in $in query</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/560</link>
    <description>&lt;pre&gt;Hello all!

Suppose that 'group' is an array of terms, like ['food', 'wine',
'desserts']. In the case that I do a query like this

var stream = Model.find( { tag : { $in : group } }).stream();

is there any way that I could have access to the term which was
matched? For example, if the first match from the stream was doc1,
is there some attribute like

doc1.match = 'food'

to tell me which of the group terms was matched? If not in mongoose,
is there a way to do this in mongodb directly?

Thanks in advance!

&lt;/pre&gt;</description>
    <dc:creator>Petrov</dc:creator>
    <dc:date>2012-05-13T10:44:09</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/552">
    <title>_doc property</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/552</link>
    <description>&lt;pre&gt;Hi, I have a Schema defined in one module, and in another module, I modify 
the Schema and add mongoose-auth support to it.

When a user is returned from User.where('email', email).findOne( function 
(err, user) {

...the object structure looks like below.  I have to dig into the _doc 
property to get at the real model properties -- why is this?  I'm wondering 
if something is mis-configured b/c of the mongoose-auth manipulation.  The 
user docs indicate that _doc is an internal property not to be directly 
manipulated which leads me to believe something about what I am doing is 
wrong.


   1. _activePaths: Object
   2. _doc: Object
   3. _events: Object
   4. _maxListeners: 0
   5. _posts: Object
   6. _pres: Object
   7. _saveError: null
   8. _selected: undefined
   9. _shardval: undefined
   10. _strictMode: false
   11. _validationError: null
   12. errors: undefined
   13. isNew: false
   14. save: function () { var self = this , hookArgs // arguments 
   eventually passed to the hook - …
   15. __proto__: Object

&lt;/pre&gt;</description>
    <dc:creator>Davis Ford</dc:creator>
    <dc:date>2012-05-10T03:35:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/551">
    <title>getting prior values of modifiedPaths?</title>
    <link>http://comments.gmane.org/gmane.comp.lang.javascript.mongoose/551</link>
    <description>&lt;pre&gt;Hi all,

Is there a way to get the the prior value of a modified path?

I'm trying to generate events whenever documents are changed. The simplest
solution I can think of is attaching a pre "save" middleware to all
schemas. This middleware would check the modified paths of the document and
save an event that includes the prior and current values. Has anyone done
something like this?

Thanks,
Rafael

&lt;/pre&gt;</description>
    <dc:creator>Rafael Garcia</dc:creator>
    <dc:date>2012-05-09T20:17:16</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.lang.javascript.mongoose">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.javascript.mongoose</link>
  </textinput>
</rdf:RDF>

