Database
44 results found
-
Is there any limitation on size of query in pipeline (character in query, not data)
I have an aggregate query, when the character in pipeline over 21066 character, the result return wrong format that the pipeline expected. So I wonder is there any limitation on size of query in pipeline?
My case is:
Query: [
"$match":{"profileID": {"$in": ['', .....]}},
{"$group":{"_id":"$profileID","materialLevel2":{"$sum":{"$cond":[{"$and":[{"$eq":["$expenseL2","true"]},{"$eq":["$expenseL3","false"]},{"$eq":["$expenseL4","false"]}]},1,0]}},"materialLevel3":{"$sum":{"$cond":[{"$and":[{"$eq":["$expenseL3","true"]},{"$eq":["$expenseL4","false"]}]},1,0]}},"materialLevel4":{"$sum":{"$cond":[{"$eq":["$expenseL4","true"]},1,0]}}}}
]The true result is:
[{
"_id" : "000.03.50.H29",
"materialLevel2" : 1.0,
"materialLevel3" : 1.0,
"materialLevel4" : 2.0
},...]But when the length of query greater than 21066 character, the result of query is:
[{
"profileID" : "00.00.00.PTT",
"expenseL2" : "true",
"expenseL3" : "true",
"expenseL4" : "false"
},....]Thanks!
1 vote -
Support concise correlated queries for $graphLookUp
Similar to $lookUp, support concise correlated queries for $graphLookUp.
It would allow adding a $project stage to reduce overhead.
1 vote -
$sort should allow 0 as argument meaning "no sort"
The $sort operator and aggregation stage should allow 0 (possibly also null) as an argument for the field sort order, meaning, "Don't sort."
This allows a variable to be passed in that can conditionally skip the sort operation, in addition to the present specification, in which a variable can only choose ascending or descending sort.1 vote -
Feature to perform Machine Learning predictive analysis and classification in MongoDB
I want to bring the machine learning compute and predictive analysis into MongoDB atlas. Instead of ETL my data out of Atlas to achieve this, I will reduce my architectural complexity by having an aggregation operator that does this on my documents stored in Atlas.
1 vote -
Add Relaxed mode support for the $out operator
Add Relaxed mode support for the $out operator.
*and include as option in the existing drivers1 vote -
Aggregations should allow an empty sort stage instead of returning an error
When you run an aggregation pipeline that contains an empty sort stage (like
{"$sort": {}}
) MongoDB returns the error message "$sort stage must have at least one sort key". It would be really helpful if such a stage would work and simply not apply any sorting at all.For one this would be more consistent with a find operation (e.g.
db.runCommand({"find": "test", "sort": {}})
ordb.test.find({}, {}, {"sort": {}})
) which does not return an error but simply does not sort the results. More importantly it would also make it easier for developers and frameworks to dynamically generate the…1 vote -
Make $merge support DELETE operation
Currently, the
$merge
only supports insert/update/upsert/merge behaviour. It would be great to support delete behaviour. A common use case would be in-place document deduplication/clean-up in a collection.1 vote -
Sorting support on Array fields.
Presently, I'm attempting to arrange(sort) the documents within my collection based on a key nested within an array object. However, sorting isn't functioning as expected in this scenario.
A proper explanation with example is here what I mean.
https://www.mongodb.com/community/forums/t/how-to-sort-documents-in-collection-on-basis-of-array-fields/270867?u=samrat_n_a1 vote -
JSON
I'm converting a lot of data for export from MongoDB -> Postgresql
I would like an aggregation function to convert an object to JSON
{
"$addField": {
"_id": true,
"json": {
'$convert': {
'input': '$subdocument',
'to': 'json', # // Idealy, +1 for msgpack https://msgpack.org/
}
}
}
}thus object.json would be a STRING "{abc: true}"
FYI: Postgresql supports JSON(B) in it's field structures: https://www.postgresql.org/docs/current/datatype-json.html
1 vote -
support parallel query executions include find(), aggregation()
To use multi-core environment and enhance the query performance w/ a large amount of documents, need a parallel execution.
Sharding or microsharding is not an alternative in this case.3 votes -
define the random seed manually, for $rand and $sample
It will be great if an additional paramater to define the seed for $rand and $sample could be use.
2 votes -
$group all fields
$group should have the ability to allow specifying all fields in a document (without explicitly defining them all, which can lead to duplicating dozens of lines just to do "key: $first")
This will help users that use $unwind and then want to $group the results without having to do a subsequent $lookup and $mergeObjects (or similar) to get the final document structure they're looking for.
1 vote -
Flatten arrays in group stage
Have group operators to flatten document arrays into a single one with or without repeated elements.
So ->
doc1 = {arr: [1,2,3,4], gr: "group"}, doc2 = {arr: [5, 6, 7, 8], gr: "group"}
{$group: {id: "$gr", arrays: {$***: "$arr"} } }
=>
{id: "gr", arrays: [1, 2, 3, 4, 5, 6, 7, 8]}2 votes -
$merge
Report number of docs matched, merged, skipped, etc. from a $merge stage. Alternatively, return the merged doc results as a pipeline result to pass to additional stages.
3 votes -
Add SHA2, SHA3 and ECDSA functions to agg framework
It is very useful (and valuable security-wise) to be able to reverify hashes and signatures "on-engine" instead of dragging material out to a client app and running the algo there. The implementations are straightforward and everywhere now so it's not a huge lift for the backend. Example use:
aggregate([
{$match: whatever},
{$addFields: {
hashok: {$cond: [ {$eq: [ {$sha3: "path.to.struct"}, "path.to.stored.sha3"} ], 1, 0},
sigok: { $verify: { sig: "path.to.sig", pubkey: "path.to.pubkey", algo: "name of curve to use eg. SECP256k1}}
}
])
The digest function would operate on the raw BSON behind the scenes.1 vote -
Improve the mongo query language
Sometimes I find Mongo query language as not put very well together, sometimes it feels like a patch job. It would be nice, if you could make you query language easier to reason about. It would be awesome, if you could introduce fluent style api builder instead of building bson documents.
1 vote -
Add functionality to specify the readConcern level at db.collection.findOne()
Add functionality to specify the readConcern at db.collection.findOne(). At the version 5.0.14 it's not supported.
1 vote -
geo
It would be nice to get the length of an LineString of a geo-json object or the possibility to write an aggregation to calculate it.
2 votes -
Add hash function (eg. md5) to aggregation pipeline
I would like to implement hash-based sharding in my own application on top of MongoDB. For that purpose, I would like to pull a stable pseudorandom subset of documents into each of my servers, and I would like to do so without enlarging the documents by adding additional fields, and without using JavaScript in the aggregation pipeline (for performance reasons).
The idea: add a hash function, such as md5, to aggregation pipelines. The function would accept an object/array containing the data to be hashed, and would return the hash, ideally as a number.
1 vote -
$dateDiff operator should be useful to calculate age
In the documentation it says: " For example, two dates that are 18 months apart would return 1 year difference instead of 1.5 years.". But if startDate is 2021-08-01 and endDate is 2023-02-01, the result is 2 years difference. I think it should be good if this operator could be used to calculate the age.
1 vote
- Don't see your idea?