Mongoshell treats numbers as float by default. So if you want them to be treated as something else, tell this to mongo explicitly. For your case, you have to use NumberInt().
So var array = [NumberInt("1"), NumberInt("2"), NumberInt("3")];
P.S. you might find my another answer (which is similar) helpful as well.