skip to Main Content

How to access one single collection in a database in MongoDB

When connecting to MongoDB with a Node.JS application using express, how do you connect to just one collection if the database has multiple collections? I have the following MONGODB_URI: MONGODB_URI=mongodb+srv://username:******@cluster0.dayw5.mongodb.net/phonebook?retryWrites=true&w=majority The database "phonebook" has three collections, "numbers", "users" and "people".…

VIEW QUESTION

find mongodb collection document with date String

I have date string like 2022-05-17 And My mongodb collection document like { "_id": { "$oid": "aabbccddeeff" }, "title": "test", "content": "test", "author": "tester", "churchId": { "$oid": "e5eakjshuwb3546" }, "markAsRead": false, "createdAt": { "$date": "2022-05-17T08:18:57.174Z" }, "updatedAt": { "$date": "2022-05-17T08:18:57.174Z"…

VIEW QUESTION

Mongodb – Cast to ObjectId failed for value "6283201d60c794631cd1ba33n" (type string) at path "_id" for model "Post"

I'm working on a social media project and getting this getting when I'm sending like/Unlike post request CastError: Cast to ObjectId failed for value "6283n" (type string) at path "_id" for model "Post" at model.Query.exec (E:social-media-app-mernnode_modulesmongooselibquery.js:4639:21) at model.Query.Query.then (E:social-media-app-mernnode_modulesmongooselibquery.js:4738:15) at…

VIEW QUESTION

mongodb pyspark connector set up

i have followed the link here to install, build is succesful but I cannot find the connector. from pyspark.sql import SparkSession my_spark = SparkSession .builder .appName("myApp") .config("spark.mongodb.read.connection.uri", "mongodb://127.0.0.1/intca2.tweetsIntca2") .config("spark.mongodb.write.connection.uri", "mongodb://127.0.0.1/intca2.tweetsIntca2") .config('spark.jars.packages', 'org.mongodb.spark:mongo-spark-connector_2.11:2.2.2') .getOrCreate() df = spark.read.format("com.mongodb.spark.sql.DefaultSource").load() Py4JJavaError: An error occurred…

VIEW QUESTION
Back To Top
Search