开发者

MongoVue and Boolean

开发者 https://www.devze.com 2023-03-14 00:06 出处:网络
I\'d like to know how to insert a boolean with MongoVue tool. I tried { \"IsGlobal\": True, } // error wh开发者_运维技巧en clicking insert button

I'd like to know how to insert a boolean with MongoVue tool.

I tried

{
  "IsGlobal": True,
}

// error wh开发者_运维技巧en clicking insert button

and

{
  "IsGlobal": "True",
}

// it becomes a string

and

{
    "IsGlobal": new Boolean("True"),
}

// I get "Unable to parse Json: new Boolean..."

Any help would be appreciate.

Thanks guys !


The answer, is

{ 
    "IsGlobal": true, 
} 


While inserting you need to make sure you are using proper boolean keywords like (true,false).It should always start from lower case not from capital case.

db.UserCredential.insert({"flag":true}) WriteResult({ "nInserted" : 1 }) db.UserCredential.insert({"flag":false}) WriteResult({ "nInserted" : 1 })

0

精彩评论

暂无评论...
验证码 换一张
取 消