Re: Existing document not found

17 views
Skip to first unread message
Message has been deleted

Stephen Steneker

unread,
Oct 22, 2012, 10:13:41 AM10/22/12
to mongod...@googlegroups.com

When I try to run this query : { "d._Fields.EXTERNAL LINK" : /^http:\/\/www.migros-kulturprozent.ch\/Media\/http:\/\/assetwizard.kulturprozent.additiv.ch\/Image\/Get?Path=asd_xxx_0e3406f2-2eb4-47ed-81fe-f5a1c51ec332_.jpg$/i },  the document is not found. 
I suspect the reason to be the '?' sign.
How can I obtain the existing document ? 

Hi,

You need to escape the '?' as otherwise it will interpreted as a regular expression "optional match" metacharacter:

  db.mycoll.find({ "d._Fields.EXTERNAL LINK" : /^http:\/\/www.migros-kulturprozent.ch\/Media\/http:\/\/assetwizard.kulturprozent.additiv.ch\/Image\/Get\?Path=asd_xxx_0e3406f2-2eb4-47ed-81fe-f5a1c51ec332_.jpg$/i })

Note that in this example you could remove the /i modifier to allow the query to make more effective use of an index.

Cheers,
Stephen
Reply all
Reply to author
Forward
0 new messages