MongoDB equivalent of Oracle's NVL?

611 views
Skip to first unread message

P A

unread,
Apr 12, 2014, 7:29:29 PM4/12/14
to mongod...@googlegroups.com
Hi,

I am looking to use something to similar to Oracle's NVL feature or MySQL's IFNULL feature. What is the way to accomplish it in MongoDB?


a) Oracle:

NVL ( expr1 , expr2 )

"If expr1 is null, then NVL returns expr2. If expr1 is not null, then
NVL returns expr1."

b) MySQL:

IFNULL(expr1,expr2) 

"If expr1 is not NULL, IFNULL() returns expr1, else it returns expr2."


Asya Kamsky

unread,
Apr 13, 2014, 5:02:40 AM4/13/14
to mongodb-user
Take a look at aggregation  framework's $ifNull operator.



--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/a540fca0-89aa-474e-b81d-af945edadfd4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages