These are chat archives for Automattic/mongoose

27th
Oct 2015
John Farrow
@mildfuzz
Oct 27 2015 08:55
So this room is just people with problems, no one who actually knows the system?
Adeola Awoyemi
@dialog
Oct 27 2015 12:37
@mildfuzz: It looks like it. I've asked a question and it's gone 24hrs unanswered. Now I have to go elsewhere to find resolve my problem. :(
Diego Aguilar Aguilar
@diegoaguilar
Oct 27 2015 13:16
I tried first with classic .catch but wouldn't work
Can someone review what I posted above?
rvram
@rvram
Oct 27 2015 14:05
Hi, I am newbie to mean stack . I dont know how to access data from mongodb using mongoose. Kindly help me to do this...
Diego Aguilar Aguilar
@diegoaguilar
Oct 27 2015 15:05
@rvram did you already check the docs?
you basically will map a collection in MongoDB to a Model definition with code
Valeri Karpov
@vkarpov15
Oct 27 2015 16:15
@uptownhr backwards compatibility. If you pass a third parameter to the callback, libraries that depend on number of arguments passed break.
@mildfuzz not necessarily. I try to answer questions when possible, and there are a few others like @chetverikov and @uptownhr who know mongoose very well and occasionally answer questions. However, none of us quite have the time to answer questions as they come in. I typically just end up batching my reads for this chat room.
Valeri Karpov
@vkarpov15
Oct 27 2015 16:20
@dialog please provide additional context. Can't really tell you much without the code, we have plenty of test coverage for query middleware, so in theory the basic examples as described in the docs should work
James Lee
@uptownhr
Oct 27 2015 16:21
imho, @vkarpov15 is going above and behond answering questions in this chat room.
i'll try and help out more :)
Valeri Karpov
@vkarpov15
Oct 27 2015 16:23
@diegoaguilar we're working on a guide for this here: Automattic/mongoose#3441 . Long story short, mongoose's default promises library doesn't support .catch(). However, in mongoose >= 4.1.0 you can substitute your favorite ES6-compatible promises library. For instance, require('mongoose').Promise = global.Promise; for native promises, require('mongoose').Promise = require('bluebird'); for bluebird, or require('mongoose').Promise = require('q').Promise; for Q.
Diego Aguilar Aguilar
@diegoaguilar
Oct 27 2015 16:27
@vkarpov15 are you part of Automattic?
and so in a few words you oficially suggest to stick to a nother Promise provider?
James Lee
@uptownhr
Oct 27 2015 16:29
in a way, promises are just becoming popular due to es6 and i'm mostly glad it was implemented prior to es6 being released
@diegoaguilar it is up to you. Depends on your needs.
Diego Aguilar Aguilar
@diegoaguilar
Oct 27 2015 16:32
well my only worry is to have a coding way t o handle possible errors
James Lee
@uptownhr
Oct 27 2015 16:33
with es6, you can just use try catch
i personally don't like nesting too many promises
i think there is such a thing as promise hell
James Lee
@uptownhr
Oct 27 2015 16:39
@vkarpov15 what is your project of focus these days?
Valeri Karpov
@vkarpov15
Oct 27 2015 16:45
@diegoaguilar nope, I'm a MongoDB employee. And unfortunately yes. mpromise is the default for backwards compatibility (although this is scheduled to change in 5.0 https://github.com/Automattic/mongoose/wiki/5.0-Deprecation-Warnings) and it's sufficient for things like co/yield, but I'd recommend using else if you rely heavily on promises.
Diego Aguilar Aguilar
@diegoaguilar
Oct 27 2015 16:46
thanks @vkarpov15 do you work in San Francisco?
Valeri Karpov
@vkarpov15
Oct 27 2015 16:47
and yeah promise hell is about as real as callback hell: http://thecodebarbarian.com/2015/03/20/callback-hell-is-a-myth it's equally easy to write spaghetti code with promises as with callbacks :)
@diegoaguilar nope, NYC.
@uptownhr mongoose takes up the bulk of my time, along with education, writing, etc. Have several other MongoDB-related projects on github though, like https://github.com/vkarpov15/monogram, https://github.com/vkarpov15/dookie, https://github.com/mongodb-js/connect-mongodb-session, etc.
Diego Aguilar Aguilar
@diegoaguilar
Oct 27 2015 16:50
Nice, I guess it's nice to work at MongoDB
what is monogram for?
Valeri Karpov
@vkarpov15
Oct 27 2015 17:43
experimental ES2016-based alternative to mongoose, good experiment to see what features we can pull in :)
Luke A. Greenleaf
@gishmel
Oct 27 2015 17:45
is there a possibility that monogram would take over or are the good features of monogram just being brought into mongoose?
Valeri Karpov
@vkarpov15
Oct 27 2015 17:46
not sure yet, haven't really experimented with monogram enough to see how viable it is. Gonna be working on some sample apps for dogfooding later
Luke A. Greenleaf
@gishmel
Oct 27 2015 17:46
oh okay cool btw I got past my socket issues
I found it easiest to use Redis as an adapter to socket.io and then push changes as needed using typical rest only when absolutely necessary as real-time its much more cost effective to use redis than mongodb
James Lee
@uptownhr
Oct 27 2015 20:02
@vkarpov15 how functional is monogram right now?
Valeri Karpov
@vkarpov15
Oct 27 2015 20:35
in theory, with the handful of plugins I wrote, it does most of what mongoose does and a few things that mongoose doesn't. Can't say for certain until I start writing real stuff with it :)
James Lee
@uptownhr
Oct 27 2015 23:20
i'll try and give it a shot :)
@vkarpov15 what is one thing that it does, mongoose doesn't?