I’m trying to insert a large amount of text into a mongodb collection from nodejs. I’ve done some testing and found that the maximum length of the string can be only 49072. Here’s how i do it:
collection.insert({'largetext':POST["text"]});
Basically if I do a substring of (0, 49072) it works fine. (I can see the collection in mongodb). But if i do (0, 49073) then it just never appears in the db. There is no error either (I tried using {safe:true}, and using an error function to capture any errors…there weren’t any).
I’m using http://github.com/christkv/node-mongodb-native/ as my mongo driver.
Anyone have any clues what could be wrong here? I think it might be some Javascript maximum string length restriction, but if it is how do i still insert large text?
Thanks!
I’ve got a test in master that inserts a 50000 character string
https://github.com/christkv/node-mongodb-native/blob/master/test/insert_test.js#L1180
passes without any problems so this might be a red herring and the problem could be somewhere else. I would suggest you try the test and see if it passes. also make sure you are on the latest node.js version and latest npm package.