Groups
Groups
Sign in
Groups
Groups
mongodb-user
Conversations
About
Send feedback
Help
Can't use $and with Date.
1,510 views
Skip to first unread message
Charlie
unread,
Aug 1, 2012, 8:33:52 PM
8/1/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
I have a simple $and query like this:
{
"start": {
$and: [
{ $gte: date1 },
{ $lte: date2 }
]
}
}
I'm getting the error "Can't use $and with Date.". This seems like an odd limitation. Are there any fixes or efficient workarounds to this?
I suppose I could store the dates as numbers in the database but I'd rather keep them as Date objects if possible.
Thanks
Nat
unread,
Aug 1, 2012, 9:02:00 PM
8/1/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
Shouldn't this work without $and?
{
"start": {
$gte: date1,
$lte: date2
}
}
From:
Charlie <
cha...@powmedia.co.uk
>
Sender:
mongod...@googlegroups.com
Date:
Wed, 1 Aug 2012 17:33:52 -0700 (PDT)
To:
<
mongod...@googlegroups.com
>
ReplyTo:
mongod...@googlegroups.com
Subject:
[mongodb-user] Can't use $and with Date.
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to
mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel --
freenode.net#mongodb
Charles Davison
unread,
Aug 1, 2012, 9:18:13 PM
8/1/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
D'oh! Don't know why I thought I had to use an $and for this.. time to get some sleep!
Thanks for the quick help!
Reply all
Reply to author
Forward
0 new messages