nosql

Finding a specific element in nested Array MongoDB

Finding a specific element in nested Array MongoDB Question: DB Schema [{ "_id": 1, "name": "city1", "districts": [ { "id": 5, "name": "district 1", "neighborhoods": [ { "id": 309, "name": "neighborhood 1" } ] }, { "id": 6, "name": "district 2", "neighborhoods": [ { "id": 52280, "name": "neighborhood 2" } ] } }, { "_id": …

Total answers: 1

pynamodb last_evaluated_key always return null

pynamodb last_evaluated_key always return null Question: I’m using Pynamodb for interacting with dynamodb. However, last_evaluated_key always returns null even if there are multiple items. When I run this query results = RecruiterProfileModel.profile_index.query( hash_key=UserEnum.RECRUITER, scan_index_forward=False, limit=1, ) If I try getting this value results.last_evaluated_key it always returns null. However, if I dump the results object, it …

Total answers: 2

Positional operator not working in MongoDB with array elements FastAPI

Positional operator not working in MongoDB with array elements FastAPI Question: I have a document that looks like this: { "_id": "cc3a8d7f-5962-47e9-a3eb-09b0a57c9fdb", "isDeleted": false, "user": { "timestamp": "2023-02-12", "name": "john", "surname": "doe", "email": "[email protected]", "phone": "+012345678912", "age": 25, "gender": "female", "nationality": "smth", "universityMajor": "ENGINEERING", "preferences": null, "highPrivacy": false, }, "postings": [ { "id": "f61b103d-8118-4054-8b24-b26e2f4febc4", "isDeleted": …

Total answers: 1

How can I limit text score with $gt operator in MongoDB?

How can I limit text score with $gt operator in MongoDB? Question: I want to limit text scores using the $gt operator. Using the find function, I can sort the text scores according to the text similarity status from largest to smallest. I can get the cursor with the highest score by putting a limit …

Total answers: 1

Hardcoded Credentials for Dynamodb AWS Queries

Hardcoded Credentials for Dynamodb AWS Queries Question: I have a script which checks if a specific value is inside a cell in a dynamodb table in AWS. I used to add hardcoded credentials containing the secret key in my script such as this: dynamodb_session = Session(aws_access_key_id=’access_key_id’, aws_secret_access_key=’secret_access_key’, region_name=’region’) dynamodb = dynamodb_session.resource(‘dynamodb’) table=dynamodb.Table(‘table_name’) Are there any …

Total answers: 1

How do I query AWS DynamoDB in python?

How do I query AWS DynamoDB in python? Question: I’m fairly new to NoSQL and using AWS DynamoDB. I’m calling it from AWS Lambda using python 2.7 I’m trying to retrieve a value from an order_number field. This is what my table looks like(only have one record.): primary partition key: subscription_id and my secondary global …

Total answers: 6

How to make a query date in mongodb using pymongo?

How to make a query date in mongodb using pymongo? Question: I’m trying to perform a query date in mongodb, but the result is always empty. My query is as follows: //in the begin code def __init__(self): self.now = datetime.now() self.db = conexaoMongo() self.horaInicio = self.now – timedelta(minutes=1) def resultadoConsulta(self, modo, porta, id_node): #print “Porta …

Total answers: 4

How to create a fast, queryable index from many JSON files (ideally in Python)

How to create a fast, queryable index from many JSON files (ideally in Python) Question: I have 78,000 individual JSON files that I created with a Python script that scrapes a community forum and extracts information from each post. They consist of simple key-value pairs, like so: { “name”: “Chris Wilson”, “item”: “Darth Vader speaker …

Total answers: 2