mongodb-query

How to build Spark data frame with filtered records from MongoDB?

自闭症网瘾萝莉.ら 提交于 2020-06-28 03:02:31
问题 My application has been built utilizing MongoDB as a platform. One collection in DB has massive volume of data and have opted for apache spark to retrieve and generate analytical data through calculation. I have configured Spark Connector for MongoDB to communicate with MongoDB. I need to query MongoDB collection using pyspark and build a dataframe consisting of resultset of mongodb query. Please suggest me an appropriate solution to it. 回答1: You can load the data directly into a dataframe

Using Linq in MongoDb C# how to perform nested Join [closed]

有些话、适合烂在心里 提交于 2020-06-27 06:39:11
问题 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 3 days ago . Improve this question Giving these classes in C# Inbox.cs public class Inbox : TDocument { public string Name {get;set;} public List<MongoDBRef> WorkOrdersRef {get;set;} public List<InboxRule> Rules {get;set;} [BsonIgnore] public List<WorkOrder> WorkOrders {get;set;} } InboxRule.cs

What is the correct way to Index in MongoDB when big combination of fields exist

柔情痞子 提交于 2020-06-27 06:06:10
问题 Considering I have search pannel that inculude multiple options like in the picture below: I'm working with mongo and create compound index on 3-4 properties with specific order. But when i run a different combinations of searches i see every time different order in execution plan (explain()). Sometime i see it on Collection scan (bad) , and sometime it fit right to the index (IXSCAN). The selective fields that should handle by mongo indexes are: (brand,Types,Status,Warehouse,Carries ,Search

MongoDB Aggregation Performance

天大地大妈咪最大 提交于 2020-06-24 02:33:14
问题 We have a problem of aggregation queries running long time (couple of minutes). Collection: We have a collection of 250 million documents with about 20 fields per document, The total size of the collection is 110GB. We have indexes over "our_id" and dtKey fields. Hardware: Memory: 24GB RAM (6 * 4GB DIMMS 1333 Mhz) Disk: Lvm 11TB built from 4 disks of 3TB disks: 600MB/s maximum instantaneous data transfers. 7200 RPM spindle. Average latency = 4.16ms RAID 0 CPU: 2* E5-2420 0 @ 1.90GHz Total of

$replaceRoot in mongodb

北城以北 提交于 2020-06-23 07:44:34
问题 I use aggregation framework for group by of multiple fields as { _id:{_id:"$_id",feature_type:"$feature_type",feature_name:"$feature_name"}, features: { $push: "$features" } } it give result like {_id: {_id:1,feature_type:"Test",feature_name:"Tests"}, features:["23423","32423","2342342"] } but I want result like {_id:1,feature_type:"Test",feature_name:"Tests", features:["23423","32423","2342342"] } how can i acheve this using aggregration framework. 回答1: You need to use $replaceRoot to change

$replaceRoot in mongodb

。_饼干妹妹 提交于 2020-06-23 07:44:32
问题 I use aggregation framework for group by of multiple fields as { _id:{_id:"$_id",feature_type:"$feature_type",feature_name:"$feature_name"}, features: { $push: "$features" } } it give result like {_id: {_id:1,feature_type:"Test",feature_name:"Tests"}, features:["23423","32423","2342342"] } but I want result like {_id:1,feature_type:"Test",feature_name:"Tests", features:["23423","32423","2342342"] } how can i acheve this using aggregration framework. 回答1: You need to use $replaceRoot to change

How to use MongoDB transaction using Mongoose?

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-17 15:59:32
问题 I am using MongoDB Atlas cloud(https://cloud.mongodb.com/) and Mongoose library. I tried to create multiple documents using transaction concept, but it is not working. I am not getting any error. but, it seems rollback is not working properly. app.js //*** more code here var app = express(); require('./models/db'); //*** more code here models/db.js var mongoose = require( 'mongoose' ); // Build the connection string var dbURI = 'mongodb+srv://mydb:pass@cluster0-****.mongodb.net/mydb

can we write mongodb crud queries and aggregate query together?

北城以北 提交于 2020-06-15 07:09:07
问题 In MongoDB can we execute below written query? db.dbaname.find(userName:"abc").aggregate([]) else is there any other way we can execute CRUD and aggregate query together. 回答1: Short answer - No you can't do this : .find(userName:"abc").aggregate([]) aggregation-pipeline is heavily used for reads which is mostly similar to .find() but capable of executing complex queries with help of it's multiple stages & many aggregation-operators . there are only two stages in aggregation $out & $merge that

MongoDB: does document size affect query performance?

元气小坏坏 提交于 2020-06-09 08:31:26
问题 Assume a mobile game that is backed by a MongoDB database containing a User collection with several million documents. Now assume several dozen properties that must be associated with the user - e.g. an array of _id values of Friend documents, their username, photo, an array of _id values of Game documents, last_login date, count of in-game currency, etc, etc, etc.. My concern is whether creating and updating large, growing arrays on many millions of User documents will add any 'weight' to

How to get data from mongodb between including two days in mongodb using mongoose

跟風遠走 提交于 2020-06-09 05:38:06
问题 Tried to get records from mongodb between including two days but in my code only i am getting between two days. Example: 01-06-2020 to 08-06-2020 = getting records from 02-06-2020 to 08-06-2020(01-06-2020 missing) But i want 01-06-2020 to 08-06-2020 = need to get records from 01-06-2020 to 08-06-2020. How to get it? Mongodb Data: { _id:ObjectId("5edd1df67b272e2d4cf36f70"), pname:"Test 1", category:"Choco 1", todaydate:2020-06-01T18:30:00.000+00:00 }, { _id:ObjectId("5gdd1df67b272e2d4cf36f72")