Returns all of the ExplorerNavigationItems, including those that are not visible. This is useful for admin tools and other places where you need to see all of the navigation items, not just the ones that are visible to the user.
Provides access the configuration object that was initially provided to configure the provider
Returns the current user, if known. In some execution environments, mainly on server tiers like in a node.js environment, there won't be a "current user" known to Metadata since the Metadata instance is shared across all requests. In this situation you should determine the current user from the server context where you get the user payload and find the user from the UserCache.
Returns the local storage provider. This is used to store metadata locally on the client.
Returns all of the ExplorerNavigationItems that are visible to the user, sorted by Sequence. Filtered by the IsActive bit.
StaticProviderWhen an application initializes, the Provider package that is being used for that application will handle setting the provider globally via this static property. This is done so that the provider can be accessed from anywhere in the application without having to pass it around. This pattern is used sparingly in MJ.
Stores a dataset in the local cache. If itemFilters are provided, the combination of datasetName and the filters are used to build a key and determine a match in the cache
If the specified datasetName is cached, this method will clear the cache. If itemFilters are provided, the combination of datasetName and the filters are used to determine a match in the cache
OptionalitemFilters: DatasetItemFilterType[]Creates a new TransactionGroup which can be used to bundle multiple database changes for BaseEntity derived classes to be processed as a single database transaction
Helper method to find an entity by name in a case insensitive manner.
Helper function to return an EntityInfo from an Entity ID
Helper function to return an Entity Name from a given Entity ID.
Helper function to return an Entity Name from an Entity ID
Performs a full-text search across all entities with FullTextSearchEnabled=true. Uses the database-native full-text search capabilities through the provider stack.
Search parameters — SearchText is required, EntityNames and MaxRowsPerEntity are optional
OptionalcontextUser: UserInfoOptional user context for permissions
Search results with title, snippet, and relevance score per match
const md = new Metadata();
const results = await md.FullTextSearch({
SearchText: 'claude',
MaxRowsPerEntity: 5
});
// results.Results contains matches across all FTS-enabled entities
Gets a dataset by name, if required, and caches it in a format available to the client (e.g. IndexedDB, LocalStorage, File, etc). The cache method is Provider specific If itemFilters are provided, the combination of datasetName and the filters are used to determine a match in the cache
OptionalitemFilters: DatasetItemFilterType[]OptionalcontextUser: UserInfoThis routine gets the local cached version of a given datasetName/itemFilters combination, it does NOT check the server status first.
OptionalitemFilters: DatasetItemFilterType[]Always retrieves data from the server - this method does NOT check cache. To use cached local values if available, call GetAndCacheDatasetByName() instead
OptionalitemFilters: DatasetItemFilterType[]OptionalcontextUser: UserInfoOptionalproviderToUse: IMetadataProviderCreates a key for the given datasetName and itemFilters combination
OptionalitemFilters: DatasetItemFilterType[]Retrieves the date status information for a dataset and all its items from the server. This method will match the datasetName and itemFilters to the server's dataset and item filters to determine a match
OptionalitemFilters: DatasetItemFilterType[]OptionalcontextUser: UserInfoOptionalproviderToUse: IMetadataProviderReturns a list of entity dependencies, basically metadata that tells you the links to this entity from all other entities.
Creates a new instance of a BaseEntity subclass for the specified entity and automatically calls NewRecord() to initialize it. This method uses the MJGlobal ClassFactory to instantiate the correct subclass based on registered entity types. For entities with non-auto-increment uniqueidentifier primary keys, a UUID will be automatically generated.
The name of the entity to create (e.g., "Users", "Customers", "Orders")
OptionalcontextUser: UserInfoOptional user context for server-side operations. Client-side code can typically omit this. Can be a UserInfo instance or an object with matching shape (ID, Name, Email, UserRoles)
Promise resolving to a strongly-typed entity instance ready for data entry
Creates a new instance of a BaseEntity subclass and loads an existing record using the provided composite key. This overload combines entity instantiation with record loading in a single call for convenience.
The name of the entity to create (e.g., "Users", "Customers", "Orders")
CompositeKey containing the primary key value(s) to load. Use static helper methods: - CompositeKey.FromID(id) for single "ID" primary keys - CompositeKey.FromKeyValuePair(field, value) for single named primary keys - CompositeKey.FromKeyValuePairs([...]) for composite primary keys
OptionalcontextUser: UserInfoOptional user context for server-side operations
Promise resolving to the entity instance with the specified record loaded
// Load by ID (most common case)
const customer = await metadata.GetEntityObject<CustomerEntity>('Customers', CompositeKey.FromID(customerId));
Returns the Name of the specific KeyValuePairs for a given entityName. This is done by looking for the IsNameField within the EntityFields collection for a given entity. If no IsNameField is found, but a field called "Name" exists, that value is returned. Otherwise null returned
OptionalcontextUser: UserInfothe name of the record
Returns one or more record names using the same logic as GetEntityRecordName, but for multiple records at once - more efficient to use this method if you need to get multiple record names at once
OptionalcontextUser: UserInfoan array of EntityRecordNameResult objects
Returns an array of records representing the list of changes made to a record. This functionality only works if an entity has TrackRecordChanges = 1, which is the default for most entities. If TrackRecordChanges = 0, this method will return an empty array.
This method is defined in the @memberjunction/core package, which is lower level in the dependency hierarchy than the @memberjunction/core-entities package where the MJRecordChangeEntity class is defined. For this reason, we are not using the MJRecordChangeEntity class here, but rather returning a generic type T. When you call this method, you can specify the type T to be the MJRecordChangeEntity class or any other class that matches the structure of the record changes. For example:
const md = new Metadata();
const changes: MJRecordChangeEntity[] = await md.GetRecordChanges<MJRecordChangeEntity>('MyEntity', myPrimaryKey);
OptionalcontextUser: UserInfoReturns a list of dependencies - records that are linked to the specified Entity/Primary Key Value combination. A dependency is as defined by the relationships in the database. The MemberJunction metadata that is used for this simply reflects the foreign key relationships that exist in the database. The CodeGen tool is what detects all of the relationships and generates the metadata that is used by MemberJunction. The metadata in question is within the EntityField table and specifically the RelatedEntity and RelatedEntityField columns. In turn, this method uses that metadata and queries the database to determine the dependencies. To get the list of entity dependencies you can use the utility method GetEntityDependencies(), which doesn't check for dependencies on a specific record, but rather gets the metadata in one shot that can be used for dependency checking.
the name of the entity to check
the primary key value to check
Returns a list of record IDs that are possible duplicates of the specified record.
object containing many properties used in fetching records and determining which ones to return
OptionalcontextUser: UserInfoReturns true if the combination of userId/entityName/KeyValuePairs has a favorite status on (meaning the user has marked the record as a "favorite" for easy access)
OptionalcontextUser: UserInfoDetermines if a given datasetName/itemFilters combination is cached locally or not
OptionalitemFilters: DatasetItemFilterType[]This routine checks to see if the local cache version of a given datasetName/itemFilters combination is up to date with the server or not
OptionalitemFilters: DatasetItemFilterType[]This method will merge two or more records based on the request provided. The RecordMergeRequest type you pass in specifies the record that will survive the merge, the records to merge into the surviving record, and an optional field map that can update values in the surviving record, if desired. The process followed is:
The return value from this method contains detailed information about the execution of the process. In addition, all attempted merges are logged in the RecordMergeLog and RecordMergeDeletionLog tables.
IMPORTANT NOTE: This functionality ASSUMES that you are calling BEGIN TRANS and COMMIT TRANS/ROLLBACK TRANS outside of the work being done inside if you are on the database server side (not on the client side). The reason is that many API servers that use this object infrastructure have transaction wrappers for each individual API request so we are not doing BEGIN/COMMIT/ROLLBACK within this functionality. If you are using this on the client side, you don't need to do anything extra, the server side, however, must wrap this with begin/commit/rollback statements to the database server. If you're using MJAPI/MJServer this is done for you automatically.
OptionalcontextUser: UserInfoOptionaloptions: EntityMergeOptionsForces a refresh of all cached metadata.
OptionalproviderToUse: IMetadataProviderRemoves all the metadata from the local persistent storage method (which varies by provider). This generally shouldn't need to be called externally but is available to force an complete removal of local metadata in storage. NOTE: this does not remove Datasets, for removing datasets, use ClearDatasetCache()
Saves all the in-memory metadata to be updated in the local persistent storage method (which varies by provider). This generally shouldn't need to be called externally but is available to force an update to local storage as desired.
Batch form of SearchEntity. Runs the per-entity ranking against
many entities in one call. Transports as a single JSON payload in both
directions over GraphQL when invoked through GraphQLDataProvider, so
N entity searches cost one round-trip instead of N.
Server-side providers fan the call out via Promise.all to independent
SearchEntity invocations — each entity's lexical pass, semantic pass,
blending, and permission filter run independently, and the per-entity
result arrays come back aligned by input order.
Use this whenever an agent or workflow needs ranked results from more than one entity for the same user request (e.g., "find anything relevant to 'overdue payments'" across Invoices, Customers, and Notes).
One SearchEntityParams per target entity.
Array of result arrays, aligned by input order — result[i]
holds the ranked matches for params[i].
Ranked search over one entity's records, blending lexical name/text-field matching with semantic embedding cosine. Results are post-filtered by the caller's row-level read permissions on that entity.
IMetadataProvider| Method | Purpose |
|---|---|
| EntityByName / EntityByID | Look up an entity definition by name or ID. Deterministic, not ranked, returns EntityInfo. |
| FullTextSearch | Server-side text search across one or many entities using each entity's UserSearchString rule (DB-level LIKE / FTS). Returns flat per-entity result groups, no semantic ranking. |
SearchEntity (this) |
Hybrid lexical-plus-semantic ranking of records inside one entity, backed by an EntityDocument-driven vector index. Use when you need "the N most relevant records of this entity for the user's free-text request". |
| SearchEntities | Batch form — runs SearchEntity over many entities in one round-trip. |
Semantic ranking requires an Active EntityDocument of type Search
registered for the target entity (see /metadata/entity-documents/ for
the seeded one against MJ: Entities); without it, mode: 'semantic'
returns no rows and mode: 'hybrid' degrades to lexical-only.
Target entity name, search text, and optional ranking knobs.
Ranked EntitySearchResult[] — descending by score, sliced to topK.
Sets the favorite status for a given user for a specific entityName/KeyValuePairs
Class used to access a wide array of MemberJunction metadata, to instantiate derived classes of BaseEntity for record access and manipulation and more. This class uses a provider model where different providers transparently plug-in to implement the functionality needed based on where the code is running. The provider in use is generally not of any importance to users of the class and code can be written indepdenent of tier/provider.