These are chat archives for Automattic/mongoose

8th
Sep 2016
ankish94
@pulankit
Sep 08 2016 12:08
@peterbsmith2 try model.findOne({'address.coords.0':-55})
Nicholai Nissen
@Nicholaiii
Sep 08 2016 13:42
Is it possible (and legitimate) to do a query and check if the document exists before continuing with the query?
I'm asking because depending on case I wanna do different things on the document, but I don't want to handle requests on non-existing documents for every case.
I'm thinking in a .then() and then go on with the query
eg:
Document = Model.findById(123)
.then(doc => {
    if(!doc) return whatever
})
.exec()

if(case){
    Document.otherQueriesHere() /* like update or whatever */
}
raul
@appsforone_twitter
Sep 08 2016 22:29
@peterbsmith2 i have a project that i want to bring to reality!