skip to Main Content

Mongodb – The signature '(inputId: number): ObjectId' of 'ObjectId' is deprecated, use static createFromTime() to set a numeric value for the new ObjectId

I am trying to fetch a single product using ObjectId, but wherenever I am writing the code: const { ObjectId } = require('mongodb'); static findById(product_id) { // console.log("Collected product id:",product_id); //db is the database return db.collection('Product_data').find({"_id":new ObjectId(product_id)}).next() .then(singleData=>{ return singleData;…

VIEW QUESTION – Entity Framework: Save Private Field

I'm using Entity Framework with MongoDB. I have a class, Account with the following field: private readonly byte[] salt; Account is configured in Entity Framework like so: protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity<Account>().ToCollection("accounts"); } When I save an…


Mongodb – How to index a mongo complex query

I really don't understand how to improve the performance of my query using index. db.Vendite.aggregate([{$group: { _id: { anno: "$anno", mese: "$mese", cod_age: "$cod_age", cod_int: "$cod_int", cod_cli: "$cod_cli", cod_linea_comm: "$cod_linea_comm", cod_sett_comm: "$cod_sett_comm", _art: "$cod_art"}, vendite_quantita: { $sum: { $add: […

Back To Top