*i test the code in mongo shell,and php driver, get the same result*
*
*
*it seems like some bug happened on server*


=====
uo
{ "_id" : 80, "bag" : { "bm1" : 10, "bm2" : 1 }, "money" : 450 }
db.s1_users.save(uo)
cmd
{
"findAndModify" : "s1_users",
"query" : {
"money" : {
"$gte" : 50
},
"bag.bm1" : {
"$gte" : 10
},
"_id" : 80
},
"update" : {
"$inc" : {
"money" : -50,
"bag.bm1" : -10
}
},
"fields" : {
"money" : 1,
"bag.bm1" : 1
},
"new" : true,
"upsert" : true
}
db.runCommand(cmd)
{
"errmsg" : "exception: assertion
src/mongo/db/commands/find_and_modify.cpp:184",
"code" : 0,
"ok" : 0
}



*//the data was modified*

db.s1_users.findOne({_id:80,'money':{'$gte':50}});
{ "_id" : 80, "bag" : { "bm1" : 0, "bm2" : 1 }, "money" : 400 }



*if i remove the query condition
*
* "bag.bm1" : {*
* "$gte" : 10*
* }
it worked .*

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user+unsubscribe@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Search Discussions

  • Stephen Lee at Sep 10, 2012 at 8:28 pm
    Hi, this has been noted in https://jira.mongodb.org/browse/SERVER-6909 and
    should be fixed shortly.

    -Stephen
    On Monday, September 10, 2012 5:49:36 AM UTC-4, tingkun -- wrote:


    *i test the code in mongo shell,and php driver, get the same result*
    *
    *
    *it seems like some bug happened on server*


    =====
    uo
    { "_id" : 80, "bag" : { "bm1" : 10, "bm2" : 1 }, "money" : 450 }
    db.s1_users.save(uo)
    cmd
    {
    "findAndModify" : "s1_users",
    "query" : {
    "money" : {
    "$gte" : 50
    },
    "bag.bm1" : {
    "$gte" : 10
    },
    "_id" : 80
    },
    "update" : {
    "$inc" : {
    "money" : -50,
    "bag.bm1" : -10
    }
    },
    "fields" : {
    "money" : 1,
    "bag.bm1" : 1
    },
    "new" : true,
    "upsert" : true
    }
    db.runCommand(cmd)
    {
    "errmsg" : "exception: assertion
    src/mongo/db/commands/find_and_modify.cpp:184",
    "code" : 0,
    "ok" : 0
    }



    *//the data was modified*

    db.s1_users.findOne({_id:80,'money':{'$gte':50}});
    { "_id" : 80, "bag" : { "bm1" : 0, "bm2" : 1 }, "money" : 400 }



    *if i remove the query condition
    *
    * "bag.bm1" : {*
    * "$gte" : 10*
    * }
    it worked .*
    --
    You received this message because you are subscribed to the Google
    Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com
    See also the IRC channel -- freenode.net#mongodb
  • Tingkun -- at Sep 24, 2012 at 9:31 am
    Thanks a lot , Stephen
    I rollback mongo to 2.0 to avoid this issue

    在 2012年9月11日星期二UTC+8上午4时06分29秒,Stephen Lee写道:
    Hi, this has been noted in https://jira.mongodb.org/browse/SERVER-6909 and
    should be fixed shortly.

    -Stephen
    On Monday, September 10, 2012 5:49:36 AM UTC-4, tingkun -- wrote:


    *i test the code in mongo shell,and php driver, get the same result*
    *
    *
    *it seems like some bug happened on server*


    =====
    uo
    { "_id" : 80, "bag" : { "bm1" : 10, "bm2" : 1 }, "money" : 450 }
    db.s1_users.save(uo)
    cmd
    {
    "findAndModify" : "s1_users",
    "query" : {
    "money" : {
    "$gte" : 50
    },
    "bag.bm1" : {
    "$gte" : 10
    },
    "_id" : 80
    },
    "update" : {
    "$inc" : {
    "money" : -50,
    "bag.bm1" : -10
    }
    },
    "fields" : {
    "money" : 1,
    "bag.bm1" : 1
    },
    "new" : true,
    "upsert" : true
    }
    db.runCommand(cmd)
    {
    "errmsg" : "exception: assertion
    src/mongo/db/commands/find_and_modify.cpp:184",
    "code" : 0,
    "ok" : 0
    }



    *//the data was modified*

    db.s1_users.findOne({_id:80,'money':{'$gte':50}});
    { "_id" : 80, "bag" : { "bm1" : 0, "bm2" : 1 }, "money" : 400 }



    *if i remove the query condition
    *
    * "bag.bm1" : {*
    * "$gte" : 10*
    * }
    it worked .*
    --
    You received this message because you are subscribed to the Google
    Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com
    See also the IRC channel -- freenode.net#mongodb

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmongodb-user @
categoriesmongodb
postedSep 10, '12 at 10:42a
activeSep 24, '12 at 9:31a
posts3
users2
websitemongodb.org
irc#mongodb

2 users in discussion

Tingkun --: 2 posts Stephen Lee: 1 post

People

Translate

site design / logo © 2022 Grokbase