in reply to Empty variables in insertion in mongodb

Step back and look at your code, and carefully consider what it is doing.

Toolkits (like Mongo) make many things easy to specify ... some of which are sensible, and some of which are not.   It would appear to me that you have written code that restructures the table... literally, adding a new column to it.   Obviously, you don’t intend to be doing that.

Perhaps the best advice that I can give you now is ... stop whacking your head against what you are attempting to do right now, and carefully read all of the documentation that you have.   “Google It™” to find every example that the Internet and/or PerlMonks might have to offer of “existing code that works.”   Embrace the fact that you really don’t quite know what you are doing right now ... and, without a shred of embarrassment, make it your business to discover examples that you can use to put yourself back onto your intended course.

Been there.   Done that.   (Really!)   It’s a bit embarrassing, maybe, but ... it’s okay.   Welcome to the club.

Replies are listed 'Best First'.
Re^2: Empty variables in insertion in mongodb
by Anonymous Monk on Dec 27, 2013 at 16:29 UTC
    Mongo collections being sparse it does not make sense to keep null columns unless absolutely required we can always insert it in future via push if reqd.