Node.js + MongoDB: Generating shorter ID - node.js

I would like to create forum script with Node.js and MongoDB, but I have a problem with IDs which are pretty long in Mongo's case. I was already searching for solution, but I didn't find anything except the posts in which is written that I need to create ID's myself. I know more about PHP and MySQL, but I need Node for some realtime application in addition of forum. I would use generated ID for identifyng forum post, and next to it it would be thread's title - like this: address.domain/1/my-new-thread.
What do you recommend me?

I've used mongoose-pureautoinc and it works without problems.

Related

NetSuite 2015_2 PHP-SDK Two Factor Authentication

We currently have Two Factor Authentication working in the 2017_2 release of the NetSuite PHP Toolkit, but we have some code that has broken due to changes between 2015_2 and 2017_2. It seems that in 2017_2 it is also far easier to set up Two Factor Authentication.
Looking at the code, however I do see references to TokenPassport and TokenPassportSignature, which tells me that I should be able to get TBA working in 2015_2, which would give us time to figure out the rest of the issues.
My question is: How would I actually go about that? I have set $service->passport to the generated TokenPassport object. I know that my TokenPassport object works in 2017_2, and I assume it would be the same, but I don't know for sure, and I can't seem to find any information up on Elgoog.
ETA: I have seen examples of this working in 2015_2 in Ruby, but not in PHP. The backend is there, but I can't seem to be able to do this in PHP, and the Ruby examples were only snippets.
Okay, so I solved this for myself, but I may not have done it the "right" way. Here's what I did:
I took the makeSoapCall and setTokenGenerator methods from the new instance of NSPHPClient.php, and I added them to the OLD version. I had to modify the setTokenGenerator method to not require an instance of iTokenPassportGenerator, but I could have just as easily copied over that interface as well.
Basically, all that needs to happen is that we need to send the tokenPassport header, which the older version of the SDK can generate but doesn't have a method to actually send that I could find.

docpad as blogging engine, pagination and problems related to many posts?

I spent the last day setting up docpad as a blogging engine, starting from https://github.com/balupton/website
After getting everything working and looking the way I like it I came to one last issue -
In the page showing all blog posts I output document.contentRenderedWithoutLayouts for each document in #documents.
I have to be ready to handle a reasonably big blog
This means I need to do pagination.
What seems like the best way to do that?
I was thinking having posts in subfolders inside of blog, but then I have to iterate folders
assume each folder is a page paginate to next page
need to also sort so that the folder with the newest posts is the first, the folder with the next latest is rendered as page 2
Perhaps your best bet is the Paged Plugin, it will automatically split a specified document into multiple documents, and inject them into the database. Does that work for you?

What's a good node.js / mongoose form builder?

From using other frameworks I've gotten used to not building out and mapping forms to db objects manually. Since using node.js and mongoose. I'm looking for a form builder that allows the following:
automatically maps mongoose objects to form fields
handles both 'new' and 'update' use cases
allows class injection around form fields for styling
includes validation
allows one to add custom fields
Does anyone know of any such form builders for node.js, express, mongoose?
I haven't used it, or looked at it in depth, but https://github.com/oJshua/mongoose-forms looks like it may be of interest.
I know this is kind of old discussion but I just wanted to recommend checking out Formage (npm: formage)
https://github.com/Empeeric/formage
Setup is easy and straightforward. You can check it out in matter of minutes and hopefully this can help you.

Using Solr for indexing and search with Mongodb and nodejs

Does anyone have any experience with this particular stack? I'm working on a web project that will eventually contain an extremely large amount of data and was trying to get Solr to play nicely with some simple Mongodb entries but I have found little to no information about it. I found this: http://blog.knuthaugen.no/2010/04/cooking-with-mongodb-and-solr.html which is mongodb + solr + php, but I'm struggling to see how I would use node similarly. Anybody have any insight? I'd greatly appreciate it. If this is a dumb thing to try to implement, feel free to let me know as well!
Found this library: https://github.com/tjgillies/node-lucene
Doesn't look like there is much documentation there but I'll give it a go.
Update:
So a quick fix (not ideal) that worked was to use a Perl module for lucene and then using the child process functionality in Node.js, I was able to insert and search for my data inside of lucene. So for a workaround, it does the trick.
Probably as of Sep 2012, you would want to take a look at this.
https://github.com/lbdremy/solr-node-client
Good documentations http://lbdremy.github.com/solr-node-client/ (though I didnt liked the web fonts used) but seems VERY promising.
This project looks promising: https://github.com/gsf/node-solr. Not a whole lot of docs, but the tests are promisingly descriptive.
Then you would maybe do something like this in your mongoose schema:
schema.pre('save', function (next) {
// this will be triggered when your mongoose schema object is saved
// TODO add to a queue that sends the documents to SOLR in e.g. batches
// of 2000
});
http://mongoosejs.com/docs/middleware.html
I've been wanting to try mongo + SOLR + node but haven't started any coding yet.

Server-side JavaScript --> Simple Dynamic Site

Note: This is not about the merits/demerits of SSJS
I am only asking if you think it is possible to create a simple dynamic site strictly using some form of SSJS. I am in no position to do any arguing (0 programming experience) -- I can only give you the benefit of some of the most interesting tutorials and information I ran across yesterday while doing some intensive Googling. I'm posting those links here in hopes that someone will browse through them and have light bulbs go off in their head.
Here are some of those links: (hold on -- I can only post one at a time)
1) NodeJS Tutorial w/ CouchDB & HAML: http://www.robsearles.com/2010/05/28/nodejs-tutorial-with-couchdb-and-haml-erdnodeflips/
Do you think it is possible to create a simple dynamic site strictly using some form of SSJS?
2) Blog rolling with mongoDB, express and Node.js: http://howtonode.org/express-mongodb

Resources