Hola Oscar, 

Esta lista es en inglés. 

El viernes, 2 de mayo de 2014 05:57:03 UTC+2, Oscar Enrique Lotero S 
escribió:
>
> Buen dia!
>
> Tengo el siguiente código y lo que pretendo es enviar al template un 
> arreglo que contiene el siguiente schema
> *var CarSchema = mongoose.Schema({*
> * placa:  { type: String, required: 'Placa es requerida' },*
> * modelo:  { type: String, required: 'Modelo es requerido' },*
> * marca: { type: String, required: 'Marca es requerida' },*
> * color:   { type: String, required: 'Color es requerido' },*
> * username: { type: String, required: 'Usuario es requerido', lowercase: 
> true },*
> *});*
>
> y Agruparlo por username y así mostrar en el template los carros por cada 
> username con la siguiente consulta
>
> *exports.cars = function(req, res){*
> * Car.find({}, null, { sort: { 'username': 1 } }, function (err, cars){*
> * if( err )*
> * return console.error(err);*
> * else {*
> * console.log(cars)*
> * res.render( 'car/cars', { titulo: 'Vehiculos', cars: cars } );*
> * }*
> * });*
> *}*
>
> y en el template tengo 
>
> *{% for propietario in cars|groupBy('username') %}*
> *  <h2>Propietario: {{ loop.key }}</h2>*
> *  <ul>*
> *    {% for car in propietario %}*
> *    <li>{{ car.placa }}</li>*
>
> *    <li>{{ car.modelo }}</li>*
>
> *    <li>{{ car.marca }}</li>*
>
> *    <li>{{ car.color }}</li>*
> *    {% endfor %}*
> *  </ul>*
> *{% endfor %}*
>
> Pero no me quiere funcionar el GroupBy
>
> Existe algún error o algo que este haciendo mal en el código.
>
>
> Muchas Gracias
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to