Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • MongoDB : Javascript function

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 899
    Comment on it

    MongoDB - Javascript function

    $where operator : It uses to either a string containing a JavaScript expression. The full JavaScript function also used in the query system. This feature available after MongoDB version >= 2.4.

    List of properties:

    args
    MaxKey
    MinKey
    

    List of some javascript function that can be used in MongoDB query:

    assert()
    BinData()
    DBPointer()
    DBRef()
    doassert()
    emit()
    gc()
    HexData()
    hex_md5()
    isNumber()
    isObject()
    ISODate()
    isString()
    
    Map()
    MD5()
    NumberInt()
    NumberLong()
    ObjectId()
    print()
    printjson()
    printjsononeline()
    sleep()
    Timestamp()
    tojson()
    tojsononeline()
    tojsonObject()
    UUID()
    version()
    

    E.g. We want to findout the employee age is greater than 40.

    db.collection.find({$where: function() { return this.age > 40 }});
    

    Above query return employee which age is greater than 40.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: