monk - Using the value of a MongoDB field to update another field -
i have mongodb document structure this:
{ testvalue: 10, maxvalue: 20 }
i want set testvalue
arbitrary integer value between 0 , maxvalue
. ideally, this:
db.collection.update( {}, { $set: { 'testvalue': newvalue }, $min: { 'testvalue': 0 }, $max: { 'textvalue': $maxvalue } } )
but doesn't work. there handful of threads relate question (e.g. update mongodb field using value of field), they're few years old, , can't find pertinent information in official documentation. there way want, or have use find() maxvalue
separate call database using update()?
this still not possible in mongo 3.2 or lower, check example these jira tickets:
Comments
Post a Comment