These are chat archives for Automattic/mongoose

1st
Nov 2015
James Lee
@uptownhr
Nov 01 2015 19:58
i'm doing some data cleanup work on a mongodb. Does anyone know if the native mongo update query supports updates based on a conditional function? For example,
{
  email: 'asdf@asdf.com',
 verified: 'false'
}
I want to query for all documents where verified is false and then run a validation function. if the validation function checks out, it updates verified to true
Joseph Thibeault
@jrthib
Nov 01 2015 20:00
You might be able to use the $where function
James Lee
@uptownhr
Nov 01 2015 20:00
db.test({ verified: 'false' }, { ... do some function validation and update ... } )
I know this can be done using node but was wondering if there is a native way to do it
@jrthib thanks, checking it out