Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query 2 - (Regular Expressions Support) #4

Open
fvonschrenk opened this issue Oct 7, 2011 · 2 comments
Open

Query 2 - (Regular Expressions Support) #4

fvonschrenk opened this issue Oct 7, 2011 · 2 comments
Assignees

Comments

@fvonschrenk
Copy link

regex runs don't use /xxx/

db.num.find();
{ "_id" : ObjectId("4e8ef812a3963e830a27360a"), "value" : 1 }
{ "_id" : ObjectId("4e8ef818a3963e830a27360b"), "value" : 2 }
{ "_id" : ObjectId("4e8ef81ba3963e830a27360c"), "value" : 3 }
{ "_id" : ObjectId("4e8ef81fa3963e830a27360d"), "value" : 4 }
{ "_id" : ObjectId("4e8ef825a3963e830a27360e"), "value" : 5 }
{ "_id" : ObjectId("4e8ef82ba3963e830a27360f"), "value" : 6 }
{ "_id" : ObjectId("4e8ef82ea3963e830a273610"), "value" : 7 }
{ "_id" : ObjectId("4e8ef831a3963e830a273611"), "value" : 8 }
{ "_id" : ObjectId("4e8f5674a3963e830a273616"), "value" : 9, "value1" : 9, "value2" : "Frank" }

    private function reg(cursor:Cursor):void{
        if (cursor.toArray().length==2){
            dispatch(new TestEvent(TestEvent.PASS,"pass   $or"));
        }else{
            dispatch(new TestEvent(TestEvent.FAULT,"fault  $or"));
        }

        var docOut:Document = new Document(); 
        var docIn:Document = new Document(); 

        docOut.put("$regex", "ra");
        docIn.put("value2",docOut);

        dm.db.collection("num").find(docIn).add(enda);
    }

    private function enda(cursor:Cursor):void{
        if (cursor.toArray().length==1){
            dispatch(new TestEvent(TestEvent.PASS,"pass   $regex"));
        }else{
            dispatch(new TestEvent(TestEvent.FAULT,"fault  $regex"));
        }
    }
@fvonschrenk
Copy link
Author

pass $gt
pass $lt
pass $gte
pass $lte
pass $all
pass $nin
pass $or
pass $regex

@s9tpepper
Copy link
Owner

I think it still needs some work so you can actually do something like:

var docOut:Document = new Document(); 
var docIn:Document = new Document(); 

var myRegex:RegEx = /ra/i;
docOut.put("$regex", myRegex);
docIn.put("value2",docOut);

dm.db.collection("num").find(docIn).add(enda);

This way you can set up more complicated regular expressions and use the flags that are supported by MongoDB. Maybe there's a way to do it with the current support, but I need to properly add support for regular expressions still.

@ghost ghost assigned s9tpepper Oct 8, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants