Database
38 results found
-
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 -
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 -
$currentDate option to only update if the document was modified
A common pattern in a data model is to have a field that denotes when the data was last modified. For this example, let this field be called "updated". I want to toggle a field on a document called "enabled", and if the value is modified I also want to update the "updated" field.
This behavior is possible right now via a comment shown in SERVER-42084, but ONLY if we include the entire document, which is not acceptable when you only want to modify a single field. This document could have other fields that are numeric and are updated atomically,…
1 vote -
Need an array query operator like elem match which matches all array nested object instead of at least one array element
as per documentation elem match query matches at least one match in array of nested object,
same we need a array query operator which returns the whole document only if elem match like criteria matches all elements in array of nested objects.
I have gone through usecase of $all with $elemMatch but it behaviour different it is like $and with $elemMatch instead excepted behaviour i am asking or excepting mentioned earlier.
https://www.mongodb.com/docs/manual/reference/operator/query/all/#use--all-with--elemmatch
https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/1 vote -
Make redundant createView() a no-op
If I call createView() with params that match an existing view (in name and all other attributes), it returns an error. It'd be more convenient if the call simply succeeded without doing any work. The behavior I propose is analogous to the way that createIndex() behaves. With the current behavior my only choices are to (1) unconditionally drop and recreate the view, or (2) read the current view definition and see whether it matches the definition I want. The first choice is unacceptable because for a period of time (albeit a short one) the view won't exist and queries that…
1 vote -
Allow Dynamic Object In $project and $addFields
Assume I have a field mapping defined in some configuration collection of my application. And this field mapping varies for different clients on my application.
I would like to pass the dynamic object in my $project or $addFields stage
Like:
$project: {
{$arrayToObject: "$field_mapping"},
}{$arrayToObject: "$field_mapping"} would return something like
"email" : "$data.Email",
"phone" : "$data.Phone,
"firstname" : "$data.FirstName",
"lastname" : "$data.LastName",
"preferredchannel" : "$data.Channel",
"preferredlanguage" : "$data.LanguageCode",
"emailchannel" : "$data.Email",
"smschannel" : "$data.SMS",
"province" : "$data.CustomerState"1 vote -
Create operators that support Centrality Algorithms use cases
Degree Centrality
Closeness Centrality
Harmonic Centrality
Betweenness Centrality
Eigenvector Centrality
PageRank
ArticleRank1 vote -
Add a $sample accumulator operator
So that it's easier to sample a number of items from each group, instead of writing lengthy DSL like this:
Ideally it can be expressed like this:
{
$group: {
_id: '$year',
samples: { $sample: 100 },
}
}
Hence making sampling 100 items from each group a snap to achieve!
1 vote -
kNN Searches with MongoDB
Dear MongoDB team,
The possibility for kNN searches within a collection would be a real game changer. Not only in machine learning, but also in other areas you need this query method to find similar structures.
Practically, it could go in the same direction as text searches. So that you have to create an index that you can also query similarly and then sort according to the score.I speak from my own suffering, as I had to switch from MongoDB to Open-/Elasticsearch for my current project, as they are also non-relational databases but support kNN searches. However, I like…
1 vote -
Add option to $dayOfWeek to choose between Monday and Sunday
Hi!
I was wondering if you could add an optional parameter to $dayOfWeek that allows you to choose on which day you want the functionality to start counting.
Thanks!
1 vote -
Add regex support in pipeline operator `replaceAll`
It would be very nice to have something like this possible:
{ $replaceAll: { input: "$text", find: "/[;,.]/g", replacement: "." } }
Many thanks !
1 vote -
the profile output in association with the $comment query operator need to have consistency across operations.
I have observed the different profile result with regard to $comment query operator in association with find and update operation respectively as follows;
find operation shows a comment on the command.filter.$comment and the command.comment field in the system.profile collection.
op: 'query',
ns: 'db101.Bets',
command: {
find: 'Bets',
filter: {
_id: ObjectId("61a9db4b3bd34e4f68fb9abc"),
'$comment': 'test-dba'
},
comment: 'test-dba',
lsid: { id: UUID("43ebee67-3184-4ede-9cee-ecca7457861a") },
'$db': 'db101'
},update operation shows a comment only on the command.q.$comment field in the system.profile collection.
op: 'update',
ns: 'db101.Bets',
command: {
q: {
_id: ObjectId("61a9db4b3bd34e4f68fb9abc"),
'$comment': 'test-dba'
},
u: { '$set': { odds: 0.5 } },
multi:…
1 vote -
multiple centersphere as a geometry for geowithin
im looking at one of my queries that a system regularly runs and some times we look for records that are within up to 250 different centerspheres, i wornder if we could enable, like geowithin has the ability to support multiple poligons, we could enable multiple centerspheres ,
$match: {{'location':{
"$geoWithin" : {
"$centerSphere" : [[ 14.4321, -9.4321], 2.5232135647961246e-05]
}
}}, {'location':{
"$geoWithin" : {
"$centerSphere" : [[ 14.4321, -9.4321], 2.5232135647961246e-05]
}
}}, ...}
we could do :
```
$match: {'location':{
"$geoWithin" : {
"$centerSpheres" : [
[[ 14.4321, -9.4321], 2.5232135647961246e-05] ,
[[ 14.4321, -9.4321], 2.5232135647961246e-05],
...
]} }}
1 vote -
$populate stage
Please provide a $populate stage that allows to resolve single referenced documents.
Internally it could use the combination of $lookup and $unwind:Related:
https://stackoverflow.com/questions/37793844/mongodb-how-to-resolve-dbref-on-client-side
1 vote -
Provide straightforward syntax for 1-to-1 joins in aggregation
The syntax for joins that bring back multiple documents from foreign collections is very straightforward and yields exactly what one would expect, but simple joins that are bread and butter in SQL require very convoluted and expensive to run syntax.
Consider a product database that has
products
,categories
andreviews
collections. Each product has a unique category and may have multiple reviews. Getting all reviews in an aggregation is very straightforward (top stage), but getting categories, similar to SQL, is as convoluted as it gets (bottom stage).
…db.products.aggregate( [ // // Document aggregates naturally aggregate foreign documents // into
1 vote
- Don't see your idea?