Abstracting mongo functions with NextJS - mongodb

I'm working on a new NextJS project that uses MongoDB.
Right now I'm having a hard time finding the best practices for next + mongo.
Would it be a good setup to have a /util/mongo folder where I store all my queries and mutations?
I could then use those in getServerSideProps.
Would appreciate any pointers to good reading material as well.
Thanks!

Related

MongoDB + Google Big Query - Normalize Data and Import to BQ

I've done quite a bit of searching, but haven't been able to find anything within this community that fits my problem.
I have a MongoDB collection that I would like to normalize and upload to Google Big Query. Unfortunately, I don't even know where to start with this project.
What would be the best approach to normalize the data? From there, what is recommended when it comes to loading that data to BQ?
I realize I'm not giving much detail here... but any help would be appreciated. Please let me know if I can provide any additional information.
If you're using python, easy way is to read collection chunky and use pandas' to_gbq method. Easy and quite fast to implement. But better to get more details.
Additionally to the answer provided by SirJ, you have multiple options to load data to BigQuery, including loading the data to Cloud Storage, local machine, Dataflow any more as mentioned here. Cloud Storage supports data in multiple formats such as CSV, JSON, Avro, Parquet and more. You also have various options to load data using Web UI, Command Line, API or using the Client Libraries which support C#, GO, Java, Node.JS, PHP, Python and Ruby.

Framework to build API REST service for Redis database?

We start buliding an application like Tinder but not exactly the same :) We want to make a Rest service with API for Redis database to get the best performance for multiple queries going from client app. Which framework we can use? Which can offer the best performace with lowest latency?
Programming language is irrelevant for us. We will be appriciated if someone can give us advice. We must use the best technology.
Best regards for all of You :)
Better go with the Oracle database compared to the Redis database,
because in future it will become an problem for your code
Redis with your source code will be always tightly coupled very much
compared to other databases.also in redis they are not providing much
support for the customers as compared to the oracle database.
The information availability for the redis database is very lower and
oracle is pretty higher and convenient and easy to use it.
The one best thing it will give best performance from db compared to
other db .redis db much more milliseconds faster response time.
but anyway i will provide some link that will help you.
Redis DB Documentaion
Redis DB Discussions in Google groups

MultiShardQuery on SQL Azure Elastic Scale with Entity Framework

I am new in Azure and I am trying to implement multishard query using Elastic Scale and Entity Framework. Unfortunately I am not able to find any example solutions or good practises to achieve that target. Can anyone help me in this issue? I would be very grateful for some materials to study or hints. Thank you in advance.
Thanks for your question on multi-shard queries with Elastic Scale and EF. Currently, a straight-forward integration like the one you probably saw for data-dependent routing is not available for multi-shard queries. This is an area we are currently investing in, though. Please contact me directly over email at torsteng(at)microsoft(dot)com and we can discuss whether your use case is a good fit and we can get you unblocked.
Thanks,
Torsten
Update for 2015, Having come across similar requirements, I contacted Torsten to see if the situation has changed, kindly he got back to me.
Hi Matt,
If your cross-db querying scenario with EF is limited to read-only access on >the shards, I’d suggest to take a look at Elastic Query for SQL DB – currently >in preview. The best entry points are probably the following documents:
Overview: https://azure.microsoft.com/enus/documentation/articles/sql-database-elastic-query-overview/
Step-by-step tutorial: https://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-query-getting-started/
With Elastic Query set up, you can point an EF DbContext to the external tables >you have defined using the Elastic Query DDL. That DbContext can then be used >for everything that requires cross-db querying. This is a somewhat intricate >mix between code-first and db-first. But, it should get you off the ground.
The instructions seem simple enough, but do involve setting up another database (at the moment premium) in azure. Hope that helps.
Coming back to the thread since now the sample for using elastic database tools (previously known as Elastic Scale) is now available with EF here.
Hope this helps!
Thanks
Silvia Doomra

Mongodb document versioning using spring data

I am using Spring Data in my Java application to connect to MongoDb and have a requirement around versioning the documents (basically storing the history).
It seems that its pretty straightforward in Ruby, if one uses Mongoid
I was wondering if spring data has something similar for Java. Or are you better of trying to implement your own.
Yes there is a very good feature in Spring data which is auditing you can refer to the following link
http://www.javacodegeeks.com/2013/11/auditing-entities-in-spring-data-mongodb-2.html
After lot of research I found that https://javers.org/documentation/spring-boot-integration/. This works like rock solid and very easy to implement.
This library helps to store all the history of the changed fields and easy to query over it and it has great support of it. The sample POC shared here: https://nullbeans.com/auditing-using-spring-boot-mongodb-and-javers/

Testing strategy for Go with Mongodb

I am trying to get a project started in Go and MongoDb. I am stumped when trying to figure out the best way to unittest my database interactions.
Normally people use database mocks, read here for the same answer in Java.