Object Not Found on Update

https://7bom7bqipiks.usemoralis.com:2053/server

does it work with other tables or it never worked?

I have not needed to update other tables. I can try i guess.

It has never worked, this is my first time implementing it.

List/Get/Create all seem to work fine. It is only the update that is letting me down.

This table was populated with Direct Database access. That could be another difference.

https://docs.moralis.io/moralis-server/database/direct_access


import json
import pymongo

MONGO_HOST = "2342"
MONGO_PORT = 56728

con = pymongo.MongoClient(MONGO_HOST, MONGO_PORT)
qualifier_table = con['parse']['AirdropQualifier']

with open(f"qualifier_data.json","r") as json_file:
    white_list = json.load(json_file)

qualifier_table.insert_many(white_list)

The createdAt and updatedAt fields are (undefined)

I saw that the table seems to have strange data, like no createdAt or updatedAt, and the objectId seems strange, maybe that is the problem

I’ll try adding those fields when i populate the database. This is starting to make sense!

It’s looking better in the tables, but still the same error.

can you try not to set the objectId and maybe it creates automatically an object id?

That’s what we did originally.

I tried again, setting only createdAt and updatedAt and it now has duplicated ids.

I’ll try doing it manually via the Moralis SDK but with 23k rows it is not ideal.

where is bulk write too

createdAt and updatedAt shouldn’t be the problem, but that ID didn’t look like an id with the same format as in the other tables

BulkWrite only works from cloudfunctions.

This is going to take awhile.

can you test first if it works fine with few rows?

It fails with 20 rows. All objectIds appear to be unique

This works. It appears to be an issue with direct database access. When i manually upload each row individually, then the cloud function works just fine.

1 Like

Hi Daniel,

I write this code on Job Clound and I got same issue like you, I just have 1 row :).

      const query_trans = new Moralis.Query('Transactions');
      query_trans.equalTo('hash','0xa56f');
      const results = await query_trans.first({useMasterKey: true});
      logger.info(JSON.stringify(results)); <---- Print correct
      results.set('status', 1);
      await results_trans.save(null, {useMasterKey: true})

But got error Object Not Found

I don’t know why ??

Did you do any changes to the database by connecting directly to mongo db?

yes bro, I m insert data directly to mongo db with my api

But on Moralis dashboard don’t show field

I still can find() but can’t update fields

You have to insert a string for id instead of an object

My syntax api:
Screen Shot 2022-09-24 at 20.09.14