David Jones
David Jones

Reputation: 10219

How to keep MongoDB from wrapping integers with NumberInt

I have a web app that posts a JSON request to a Node/Express server, which then inserts a new document into a local MongoDB database using the latest version of the mongodb Node module. When I view the documents using MongoChef, all integers are wrapped with NumberInt(x).

"shirts" : {
    "adult-x-large" : NumberInt(2), 
    "youth-small" : NumberInt(1), 
    "adult-small" : NumberInt(1), 
    "adult-medium" : NumberInt(1)
}

I'm sure these wrappers are useful for certain applications, but I really don't want my JSON filled with them. Is there a way to disable this? I'm not sure if this is a MongoDB issue, a MongoChef issue, or something else entirely.

Upvotes: 1

Views: 660

Answers (1)

notionquest
notionquest

Reputation: 39186

It is just a display part in MongoChef. If you view the data in "TreeView", it should show the type as Int32 with just numeric value.

As long as the datatye is "Int32", it should be correct and as expected.

MongoChef JSON View:-

MongoChef JSON View

MongoChef Tree View:-

MongoChef Tree View

RoboMongo Json View:-

RoboMongo Json View

Upvotes: 1

Related Questions