These are chat archives for Automattic/mongoose

24th
Jun 2016
Yogesh Patel
@ycpatel813
Jun 24 2016 04:46
@ycpatel813 i use angular in my frontend, with angular it's easy to do with default filter like {{ yourdate | date:'YYYY-MM-DD'}} @ishikawayoshi thanks for suggestion but i want to do it from backend
valli
@bunnypolisetty_twitter
Jun 24 2016 05:48
hey..hw to insert a json file into db using mongoose???
Mohamed Nasrullah
@nasr18
Jun 24 2016 06:06
already mongoose db is json based only. make it clear what u want.
valli
@bunnypolisetty_twitter
Jun 24 2016 06:07
i have file like xyz.json....now i want to push this file to my db
Mohamed Nasrullah
@nasr18
Jun 24 2016 06:08
create a schema containing that fields and map that values to this field.
Chris Blokland
@BWorld
Jun 24 2016 06:59
When I create a new document instance I see that the document itself is a mongoose object (read: not plain js object) but I have a an array of sub documents (establishments are sub docs under a store for example) and I was wondering how I could create an instance of a sub document when hydrating values..

I expected that something was possible like this:

const store = new Store();
const establishment = new store.establishments.schema();
establishment.someMethod(whatever);
store.establishments.push(establishment);

but the getter for establishments in this example returns a plain js object...

which obviously doesn't contain the establishment schema
Alex Shpak
@ishikawayoshi
Jun 24 2016 07:49
@ycpatel813 maybe http://momentjs.com/ helps you it have methods to easy date format
@bunnypolisetty_twitter you can find all this solutions in documentation
https://docs.mongodb.com/manual/reference/program/mongoimport/