MonoDB JS libraries [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am diving in MongoDB and MapReduce. You known JS language is verbose and not complete. MongoDB has more scarce JS that browers e.g. I just found that there is no "Objects.key" method. I'd like to ask for directions about JS libraries mitigating this boilerplate code for extracting keys, values into arrays and rest tasks with collections.
I tried to google such class of libraries but without any success.

Your question isn't very clear. The native JavaScript mongodb driver uses a json-like query syntax and the results are standard JavaScript objects and arrays which may be traversed using standard JavaScript. JavaScript by the specification is a very mature language, though often confusing for developers who are not familiar with prototypical inheritance.
If you are looking for a JavaScript utility belt to allow you to work with the results, I'd recommend lodash. If you want to add schemas and other traditional database features, have a look at mongoose. I prefer to use the native driver since you can do more dynamic things with low overhead.

Related

Why are linked lists not used frequently in Javascript [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I’ve been working with JavaScript for around 4 years. In all the applications I’ve worked on, I’ve never once seen someone use a linked list. Why is that? Data structures are so prominently featured in most learn-to-program courses. Yet I almost never see them used in the real world.
This may not be the perfect explanation of this but I think will give you a fair idea about it.
The scenarios which will make sense to use Linked list on JavaScript
are very rare. You have been working on JavaScript for 4 years when
did you feel a need to use linked lists and not JavaScript Array
The main purpose of using linked list is performance improvements,
when there a is a huge collection of records and frequent changes to
them linked lists help in optimizing that. But that case may not be
true for most of the JavaScript applications. Arrays are pretty much
bale to do that for JavaScript.
Most of the frameworks rely on array's be it React, Vue etc.
In case of linked list methods like unshift, etc. are much faster.
while methods on Arrays, such as push, run considerably faster than
Linked Lists.
The use of linked list is justified when you need to make a lot of
modifications to a huge list — especially when adding or removing
items somewhere other than the end of the list and such cases are rare in
JavaScript/front end.
Last but not the least JavaScript has great support for Arrays but
you will have to code your own implementation or use some library
that provides linked lists implementation.

Which code design pattern should I use in nodejs? How to design good data base? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have experience in games development(C/C++/C#) but recently I started writing automated test and I wanted to learn some backend stuff. I'm writin platform for automated backups, making builds from git repo and testing. I decide to write server in Node.js with PostgreSQL. I have 0 experience in web development. Never ever have I use a database or javascript. I think homemade project like that will be a good starting point. I want to ask two questions. First: Which code design patter will be the best for learning Node.js? Second - Could you please tell me if this pre-alpha database concept is currently good or should I change it?database
No one will be able to answer your questions as you asked them but I'll try to give you few hints. First of all PostgreSQL is a very good relational database so if you need a relational database then it's a good choice but there are other types of databases like graph databases, document databases, key-value stores etc. that you should also consider when designing your architecture. For anything complex it is common to use more than one database.
It's hard to recommend any code design pattern. I can only recommend starting from a good style guide like the one from Airbnb and enforcing it with a linter - see: http://airbnb.io/javascript/ - and following a style guide writing your backend in a style supported and recommended by a given framework that you're going to use. Some examples: Express, Hapi, Restify, LoopBack, Serverless, Seneca, Koa, Sails, etc. Google all of them and read examples to see which one feels best suited for your needs.
Links to more frameworks to consider:
http://nodeframework.com/
https://github.com/sindresorhus/awesome-nodejs

How to create a Javascript framework? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I see a lot of Javascript frameworks created recently since I've been learning web development (http://www.infoq.com/research/javascript-frameworks-2015). Do you know what kind of knowledge you need to know in order to create a Javascript framework in particular or any framework in general?
Creating a JS (or any other kind of) framework isn't something done easily, but some of the steps include:
Find a niche where no framework exists yet or doesn't cover a specific use-case, and where you have good knowledge of the problem space
Design and implement an easy to use (and, if required, future-proof) API
Publish it, e.g., on GitHub and advocate for it with a website or through blog posts
Maintain it
Hence, you'll need to know how to design good APIs, reasonable JS knowledge to build them and patience.
Note: while the initial fun starts with building out something, releasing and maintaining an actual framework is far more complex and requires time and effort - especially to build a community and once these users start requesting additional features, or your initial design considerations fall short of the new use-cases imposed by real-world usage. You can always build something and publish it to NPM, but be aware that maintaining a project in the open source community involves more than "writing code", and deprecating or deleting a framework/package can yield surprising results.

JavaScript VS Handlebars.js [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What are the benefits of using Handlebars.js, or any other such libraries, compared to just using JavaScript? So far I have not found anything in Handlebars that I cant do in just javascript.
JavaScript libraries make it easier and quicker to do things in JavaScript, anything a library can do, you can do yourself in JavaScript. But why would you? In pure JavaScript, if I wanted to select a element by id, I'd have to do this:
document.getElementById("coolId");
Or in JQuery (a JavaScript library) I could just do this:
$("#coolId");
It's quicker and easier than using pure JavaScript. Hence that's why I use JQuery to select elements and why I many different libraries - because they allow me to do things much quicker and easier than doing it myself in pure JavaScript, think of libraries as 'shortcuts' to achieving your goal functionality.
Edit: The drawbacks
However, whilst JavaScript libraries (generally) make our lives easier, as developers. They do come with drawbacks, including; large JavaScript files to download, taking longer for JavaScript engines to execute the code and, therefore, makes our code less efficient. For more on this, here are some links:
Advantages of using pure JavaScript over JQuery
What are the advantages and disadvantages of different JavaScript libraries?
The Pros And Cons Of JavaScript Micro-Frameworks
Thanks to Lix for the reminder.

Use getters/setters from framework/language or define your own explicit ones [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Where I was working as an intern, working on a JavaScript front end project with Backbone.JS, I was using those getters and setters as provided by the framework (Backbone) but was asked to define my own to make it clear whats public/private. I was more for using those provided by the backbone. Whats the better practice or recommended method here?
Then recently, I was developing my own ExpressJS/Mongoose app, I started off thinking I define a Todo model then a Todos collection that exposes functions like byId, byList etc, but then I was thinking perhaps I should just use those provided by Mongoose?
The advantage of using the provided getters/setters will be
Less code, less bugs
standard way of getting/setting. Instead of 2 (from framework + custom)
Another developer will just need to learn the framework instead of my custom code to understand whats happening
Cons:
a little longer code
less sense of whats private whats not, but I think this is not very important ... esp in a dynamic language
Again, whats recommended here?
If the framework allows it to you, write your own getters/setters only when you have to modify the behaviour of the default getters/setters.
There's no reason to write them if not needed, IMHO.

Categories

Resources