var Person = mongoose.model('Person', yourSchema); // find each person with a name contains 'Ghost' Person.findOne({ "name" : { $regex: /Ghost/, $options: 'i' } }, function (err, person) { if (err) return handleError(err); console.log('%s %s is a %s.', person.name.first, person.name.last, person.occupation); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter