$where in mongodb web shell not working
Posted
by
Bravo
on Stack Overflow
See other posts from Stack Overflow
or by Bravo
Published on 2014-06-03T09:17:59Z
Indexed on
2014/06/03
9:24 UTC
Read the original article
Hit count: 243
i have the below set of test documents which i inserted in to the mongodb and when i use to query the db using the $where get the below exception
Error: database error: $where query, but no script engine
Any idea why the $where clause not working
test data :
db.things.save({ "_id" : 1, "domainName" : "test11.com", "hosting" : "hostgator.com" })
db.things.save({ "_id" : 2, "domainName" : "test2.com", "hosting" : "aws.amazon.com"})
db.things.save({ "_id" : 3, "domainName" : "test3.com", "hosting" : "aws.amazon.com" })
db.things.save({ "_id" : 4, "domainName" : "test4.com", "hosting" : "hostgator.com" })
db.things.save({ "_id" : 5, "domainName" : "test5.com", "hosting" : "aws.amazon.com" })
db.things.save({ "_id" : 6, "domainName" : "test6.com", "hosting" : "cloud.google.com" })
db.things.save({ "_id" : 7, "domainName" : "test7.com", "hosting" : "aws.amazon.com" })
db.things.save({ "_id" : 8, "domainName" : "test8.com", "hosting" : "hostgator.com" })
db.things.save({ "_id" : 9, "domainName" : "test9.com", "hosting" : "cloud.google.com" })
db.things.save({ "_id" : 10, "domainName" : "test10.com", "hosting" : "godaddy.com" })
query used :
db.things.find( { $where: "this.domainName == 'test11.com'" } );
© Stack Overflow or respective owner