1

db.courses.find({"course_number":"/^AFPRL/"}) returns nothing.

The following is my DB entry. Forgive me as I'm very new to MongoDB. I believe I'm trying to perform the equivalent of a LIKE operation in MySQL?

{
  _id: ObjectId("51072be2f046ed1c0e000000"),
  course_number: "AFPRL 100.00",
  room: "HW  215",
}
user1426594
  • 125
  • 1
  • 6

1 Answers1

3

The regular expression is not a string. It should be

db.courses.find({"course_number": /^AFPRL/}) 
Infinity
  • 3,695
  • 2
  • 27
  • 35