Is there a way to specify the collection field name in a schema? The long descriptive field names in code are helpful but are starting to eat up bytes on our small VPS.
--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en
new Schema({ .. }, { collection: 'yourcollectionname' })
On Thu, Mar 22, 2012 at 10:39 PM, mgutz wrote:
Is there a way to specify the collection field name in a schema? The long descriptive field names in code are helpful but are starting to eat up bytes on our small VPS.
--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en
--
Aaron
var schema = new Schema({ s: String, n: Number, b: Boolean});
schema
.virtual('aString')
.get(function () {
return this.get('s');
})
.set(function (v) {
return this.set('s', v);
});
You could still use the short names in code aswell, but at least you
don't have to.
Regards,
Daniel
On 03/27/2012 12:56 AM, Aaron Heckmann wrote:
> oh right. sorry. no that option doesn't exist.
>
> On Mon, Mar 26, 2012 at 5:39 PM, mgutz<mario.l....@gmail.com> wrote:
>
>> Field names?
>>
>> I tried new Schema({userName: String, description: String}, {userName:
>> "u", description: "d"});
>>
>> The collection still has "userName" and "description" fields instead of
>> "u" and "d"
>>
>> On Monday, March 26, 2012 11:21:28 AM UTC-7, Aaron Heckmann wrote:
>>
>>> new Schema({ .. }, { collection: 'yourcollectionname' })
>>>
>>> On Thu, Mar 22, 2012 at 10:39 PM, mgutz wrote:
>>>
>>> Is there a way to specify the collection field name in a schema? The long
>>>> descriptive field names in code are helpful but are starting to eat up
>>>> bytes on our small VPS.
>>>>
>>>> --
>>>> http://mongoosejs.com
>>>> http://github.com/learnboost/**mongoose<http://github.com/learnboost/mongoose>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Mongoose Node.JS ORM" group.
>>>> To post to this group, send email to mongoo...@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> mongoose-orm+unsubscribe@**googlegroups.com<mongoose-orm%2Bunsu...@googlegroups.com>
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/mongoose-orm?hl=en<http://groups.google.com/group/mongoose-orm?hl=en>
>>>>
>>>
>>>
>>>
>>> --
>>> Aaron
>>> @aaronheckmann<https://twitter.com/#!/aaronheckmann>
I guess you could make the fields using the shortnames and setup virtuals with the long names mapping to the short attribute names: