I am trying to fetch data in field which contains expression " : ", but i am getting error of Unexpected token :
For eg:
My collection contains 2 documents like-
ObjectId(1) 123
id 1
name shubham
CreateDate 10/11/12
ObjetId(2) 456
id 2
name anant
CreateDate: 10/11/12
while fetching data using qurey -
var cursor =db.getCollection('dummydata').find({name : {$in :
[/shubham/i,/anant/i]}})
while (cursor.hasNext()) {
var record = cursor.next();
print(record.id +'|'+ record.name + '|' + record.CreateDate)
}
I am getting this output-
1|shubham|10/11/12
2|anant|undefined
even though there is CreatDate field in id =2,It is showing undefined,
Please let me know how to troubleshoot this or some other query to fetch data which include" : " expression in the field.