নিচে নথি এবং সাবডকুমেন্ট −
দেখানো সিনট্যাক্সdb.yourCollectionName.insertOne( { yourFiledName:yourValue, yourFieldName : [ { yourFiledName1, yourFiledName2, . . . N } ] } );
ডকুমেন্ট সহ একটি সংগ্রহ তৈরি করার উদাহরণ দেখা যাক −
> db.demo706.insertOne( ... { ... PortalName: "GameApplication", ... ApplicationConfiguration : [ ... { ... "URL": "jdbc:mysql://localhost/customer_tracker?autoReconnect=true", ... "USERNAME": "root", ... "PASSWORD": "root" ... } ... ] ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5ea6f557551299a9f98c93c6") } > > db.demo706.insertOne( ... { ... PortalName: "WebMyBusinessApplication", ... ApplicationConfiguration : [ ... { ... "URL": "jdbc:oracle:thin:@localhost:1521:xe", ... "USERNAME": "App", ... "PASSWORD": "App" ... } ... ] ... } ... ); { "acknowledged" : true, "insertedId" : ObjectId("5ea6f558551299a9f98c93c7") }
Find() পদ্ধতি -
এর সাহায্যে একটি সংগ্রহ থেকে সমস্ত নথি প্রদর্শন করুন> db.demo706.find();
এটি নিম্নলিখিত আউটপুট −
তৈরি করবে{ "_id" : ObjectId("5ea6f557551299a9f98c93c6"), "PortalName" : "GameApplication", "ApplicationConfiguration" : [ { "URL" : "jdbc:mysql://localhost/customer_tracker?autoReconnect=true", "USERNAME" : "root", "PASSWORD" : "root" } ] } { "_id" : ObjectId("5ea6f558551299a9f98c93c7"), "PortalName" : "WebMyBusinessApplication", "ApplicationConfiguration" : [ { "URL" : "jdbc:oracle:thin:@localhost:1521:xe", "USERNAME" : "App", "PASSWORD" : "App" } ] }
আপডেট করার জন্য নিম্নোক্ত ক্যোয়ারী −
> db.demo706.update({PortalName: "WebMyBusinessApplication"},{$set:{"PortalName":"OnlineCustomerTracker"}}); WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
Find() পদ্ধতি -
এর সাহায্যে একটি সংগ্রহ থেকে সমস্ত নথি প্রদর্শন করুন> db.demo706.find();
এটি নিম্নলিখিত আউটপুট −
তৈরি করবে{ "_id" : ObjectId("5ea6f557551299a9f98c93c6"), "PortalName" : "GameApplication", "ApplicationConfiguration" : [ { "URL" : "jdbc:mysql://localhost/customer_tracker?autoReconnect=true", "USERNAME" : "root", "PASSWORD" : "root" } ] } { "_id" : ObjectId("5ea6f558551299a9f98c93c7"), "PortalName" : "OnlineCustomerTracker", "ApplicationConfiguration" : [ { "URL" : "jdbc:oracle:thin:@localhost:1521:xe", "USERNAME" : "App", "PASSWORD" : "App" } ] }