Daniol Thomas

Daniol Thomas

124 Articles Published

Articles by Daniol Thomas

Page 5 of 13

How to remove a field completely from a MongoDB document?

Daniol Thomas
Daniol Thomas
Updated on 14-Mar-2026 1K+ Views

You can use the $unset operator to remove a field completely from a MongoDB document. The syntax is as follows ? Syntax db.yourCollectionName.update({}, {$unset: {yourFieldName:1}}, false, true); Sample Data To understand the above syntax, let us create a collection with some documents. The query to create a collection with documents is as follows ? db.removeFieldCompletlyDemo.insertOne({"StudentName":"Larry", "StudentFavouriteSubject": ["Java", "C", "C++", "Python"]}); db.removeFieldCompletlyDemo.insertOne({"StudentName":"Mike", "StudentFavouriteSubject": ["Javascript", "HTML5", "CSS3"]}); db.removeFieldCompletlyDemo.insertOne({"StudentName":"Sam", "StudentFavouriteSubject": ["MongoDB", "MySQL", "SQL Server"]}); { "acknowledged" : true, "insertedId" : ObjectId("5c6ef55a6fd07954a48906a3") } ...

Read More

Best way to store date/time in MongoDB?

Daniol Thomas
Daniol Thomas
Updated on 14-Mar-2026 1K+ Views

There are two different ways by which you can store date/time in MongoDB. In the first approach, you can use Date objects like JavaScript. The Date object is the best way to store date/time in MongoDB. In the second approach, you can use ISODate(). Both methods store dates in MongoDB's native BSON Date type, ensuring optimal performance for date-based operations. Syntax For Date object ? new Date(); For ISODate ? new ISODate(); Method 1: Storing Date/Time Using Date Object To understand the above syntax, let us create a collection ...

Read More

Get Random record from MongoDB?

Daniol Thomas
Daniol Thomas
Updated on 14-Mar-2026 2K+ Views

Use the $sample aggregation stage to get random records from a MongoDB collection. The size parameter specifies how many random documents to return. Syntax db.collectionName.aggregate([{ $sample: { size: N } }]); Create Sample Data db.employeeInformation.insertMany([ {"EmployeeId": 1, "EmployeeName": "Maxwell", "EmployeeAge": 26}, {"EmployeeId": 2, "EmployeeName": "David", "EmployeeAge": 25}, {"EmployeeId": 3, "EmployeeName": "Carol", "EmployeeAge": 24}, {"EmployeeId": 4, "EmployeeName": "Bob", "EmployeeAge": 28}, {"EmployeeId": 5, "EmployeeName": "Sam", "EmployeeAge": 27} ]); Get One Random Record ...

Read More

Count the number of items in an array in MongoDB?

Daniol Thomas
Daniol Thomas
Updated on 13-Mar-2026 6K+ Views

To count the number of items in an array in MongoDB, you can use the $size operator within the $project stage of an aggregation pipeline. The $size operator returns the number of elements in a specified array field. The syntax is − db.yourCollectionName.aggregate({ $project: { anyFieldName: { $size: "$yourArrayName" } } }).pretty(); Creating a Sample Collection To understand the above syntax, let us create a collection with documents. Each document contains a StudentMarks array with a different number of elements ? ...

Read More

How to select a single field in MongoDB?

Daniol Thomas
Daniol Thomas
Updated on 13-Mar-2026 29K+ Views

You can select a single field in MongoDB using the projection parameter in the find() method. Projection lets you specify which fields to include or exclude in the query results. The syntax is − db.yourCollectionName.find( {"yourFieldName": yourValue}, {"yourSingleFieldName": 1, _id: 0} ); In the above syntax, "yourSingleFieldName": 1 means include this field in the result, and _id: 0 means exclude the _id field which MongoDB includes by default. Creating a Sample Collection To understand the above syntax, let us create a collection with documents ? db.singleFieldDemo.insertOne({"StudentName": "David", "StudentAge": 28}); ...

Read More

Truncating multiple strings after 100 characters in ABAP

Daniol Thomas
Daniol Thomas
Updated on 13-Mar-2026 595 Views

You can truncate strings to 100 characters in ABAP by defining a character field of 100 bytes and moving your variable to that character field. When you move a longer string to a shorter field, ABAP automatically truncates it to fit the target field length. Example The following example demonstrates how to truncate a string to 100 characters using a fixed-length character field − DATA: lv_original_text TYPE string VALUE 'This is a very long text that exceeds 100 characters and will be truncated when ...

Read More

Calling external programs using SAP connector

Daniol Thomas
Daniol Thomas
Updated on 13-Mar-2026 345 Views

Yes, it is possible to address or call an external program using SAP connector SDK. From ABAP, you can reference external programs by SAP's RFC (Remote Function Call) protocol. RFC protocol enables communication between SAP systems and external applications, allowing seamless integration and data exchange across different platforms and programming languages. There are various SAP connectors available for different programming languages. Few of them are − JCo is the SAP Java connector NCo is the .NET SAP connector NW RFC SDK is the SAP ...

Read More

Extract data from SAP system using ERPConnect

Daniol Thomas
Daniol Thomas
Updated on 13-Mar-2026 456 Views

When extracting data from SAP systems using ERPConnect, you have two primary approaches to consider. As per my understanding of your requirements, the better option for you will be to code the selection in ABAP. Then you can wrap this selection in a function module which will be remote function call enabled. Then go ahead and use this module. But let's say you are not able to use it, then only remaining option for you will be 'RFC_READ_TABLE' but it has got its own problems. Method 1: Custom ...

Read More

Managing user sessions in SAP UI5 application

Daniol Thomas
Daniol Thomas
Updated on 13-Mar-2026 1K+ Views

You can make use of setTimeout and clearTimeout functions to manage user sessions in SAP UI5 applications. In order to trace the activity of the user, you can either make use of mouse move event or key press event or even both to detect user activity and prevent unwanted session timeouts. Session Timeout Implementation Session management works by setting a timer that will expire after a specified period of inactivity. When user activity is detected, the timer is reset, extending the session duration. This approach ensures that ...

Read More

Storing Personal Information in LDAP/AD or in SAP HR module

Daniol Thomas
Daniol Thomas
Updated on 13-Mar-2026 198 Views

LDAP can store sensitive information, but it is not recommended to store sensitive personal information in LDAP from a security point of view. This information should go to some HR information system like SAP HR module, or you can also develop a middleware to store this information securely. You can use EMP ID to track this information back to middleware or LDAP. Storage Options for Personal Information When designing enterprise systems, you have several options for storing employee personal data − LDAP/Active Directory Approach ...

Read More
Showing 41–50 of 124 articles
« Prev 1 3 4 5 6 7 13 Next »
Advertisements