The correct syntax is this (most probably based on my observation which are listed below):
$options: 'im'
List of regex options with descriptions
Data:
db.a.insert({"a" : "hello Sam" })
db.a.insert({"a" : "hello sam" })
db.a.insert({"a" : "hello\nSam" })
db.a.insert({"a" : "hello\nsam" })
db.a.insert({"a" : "hello pam" })
db.a.insert({"a" : "hello Pam" })
db.a.insert({"a" : "hello\nPam" })
db.a.insert({"a" : "hello\npam" })
Code:
db.a.find({a : {$regex : 'o.+sam', $options : 'is'}}) // Sam, sam, \nSam, \nsam
db.a.find({a : {$regex : 'o.+sam', $options : 'i'}}) // Sam, sam,
db.a.find({a : {$regex : 'o.+sam', $options : 's'}}) // sam, \nsam
db.a.find({a : {$regex : 'o.+sam', $options : ['i']}}) // sam
db.a.find({a : {$regex : 'o.+sam', $options : ['i', 's']}}) // sam
db.a.find({a : {$regex : 'o.+sam', $options : ['s']}}) // sam