Litedb join. // here, all database are in memory only.

Nov 13, 2020 · Therefore I have created a MemoryStream that I want to copy to the file. Applet () constructor",0]} ) Jan 6, 2024 · With LiteDb I noticed in their doc LiteDatabase as a core object handling connection to the db is intstantiated and disposed immediately. insert { data: [10,"java. exe) the "Shared" box is checked. This is the recommended mode because it’s faster and cachable. Feb 8, 2020 · It should work if both instances are opened in shared mode. 2 I will add support for external conversion and include your source as an external LiteDB. LiteCollection`1. May 21, 2018 · LiteDb collection returns invalid data when searching by id. If you change this locally and run all the dotnet restore/build command as specified in . SharedEngine. ReadAllBytes("data. using(var db = new LiteDatabase(@"C:\Temp\MyData. GetFreePa Aug 9, 2021 · The LiteDB Explorer has an export to JSON functionality, but I'm wondering if there's an API available in LiteDB itself to export to JSON or convert the BSON to JSON? I'm specifically looking for a PowerShell solution. To: mbdavid/LiteDBmailto: LiteDB@noreply. System. There are indexes, like you found out, but those indexes are on the JSON level, on the top level, the same as searches. Create(); using(var db = new LiteDatabase(stream) {. LiteDB v5 uses BsonExpressions, which are expressions that can be directly applied to a BsonDocument. That is why I chose to save the Ticks instead and convert them back to DateTime. Indexes. GetCollection<Account>("Account"); Account account = new Account. You can use embedded documents (sub-documents) or create a reference … Connection String Aug 30, 2016 · get rid of SSD. Every time the server receives a message, it stores the message in the DB, and sends a copy to the proper destination. Feb 23, 2017 · Did you see my unit test about your problem? Can you fork LiteDB and add an unit test about this? In my example works as expected. Up to 20 instances of the program are accessing the Exclusive mode open datafile with no share - only 1 instance of LiteDatabase can exists (file are complete locked). LiteDB work in a file based system, so it's depends a lot of disk. But it may be used just for exploring data of existing databases. In the example shown, the sink will write to the database logs. at LiteDB. Full document scans are inefficient because LiteDB must deserialize every document in the Apr 7, 2020 · uses a single file for your data and indexes. CopyTo(dest); Feb 10, 2020 · when I create a database (let's call him "DB"), it's created me a file DB. Mapping a reference on database initialization Aug 4, 2018 · Have investigate this problem for me on master (v4) and v5_vf because i need queries against a collection based on date time values. NET API. I did have issues with previous versions of Unity, so wouldn't recommend and version earlier than 2017. NET NoSQL embedded database. If I try to change a value LiteDB Studio tells me that the document was not found. Collections are analogous to tables in Feb 22, 2024 · No milestone. get rid of transaction. Arbitrary/string return value from LiteDb query. If flush = true, LiteDB will wait real write on this before Mar 14, 2017 · Here's my scenario, I need to insert around 6 million records from a flat json file into LiteDB. A collection is a group of related documents that have a set of shared indices. This article describes how . Net 461 version of LiteDb you may have a look at the changes of the csproj file in the commit of my forked repo: wgross@5027ad6. Auto index is create an index based on query execution (when you just run a query and database create an index if need). github-actions bot pushed a commit to Reddevildragg-UPM-Forks/LiteDB that referenced this issue on Nov 18, 2020. Aug 3, 2023 · It has a LiteDB database to store messages in. NET C# managed code (compatible with . x, yet I haven't found an example of it in the Wiki or any of the issues. LiteDb Where Query. NET document database. some like this: var mem = new MemoryStream(File. x, NETStandard 1. 0. Remove the predictability, toss the yield keyword out of the window. private List<Customer> GetAll() {. Jul 23, 2020 · SQLiteとLiteDBの比較. Write () at LiteDB. LiteDatabase db; LiteCollection<Contact> list; And don't forget to import the LiteDB namespace to your winform. Feb 1, 2020 · It seems like the 'FindById' operation on the database (and potentially other operations as well), leave an open cursor on the transaction. Yes, I am getting "The process cannot access the file ". 0, net6. Oct 18, 2017 · Introduction. Serilog. I think I am not the only person in need of such a solution: LLMs are moving beyond just Python, more and more functionality is getting available in C# (see e. 0). Transaction has a big issue in all LiteDB versions: keeps datafile locked with no close guarantee. Dll. using (var db = new LiteDatabase(Constants. It would be ideal if the LiteQuerable was an IQueryable interface that prevented LiteDB reference leakage. SharedDataReader. Do you plan to somehow launch AOT support at least at an experim The SELECT clause defines the projections that are applied to the results. LiteDB is a serverless database, so there is no installation. I am struggling with using Queries and Expressions to find the MAX _id item in the collection. db")) {. Transaction [T] (String collection, Boolean addIfNotExists, Func`2 action) Looks like write lock wasn't realesed. You define the schema, decide on the data types and choose which fields are required and which can have NULLs. EmptyPage' to type 'LiteDB. Documents are stored and organized in collections. In portable area, my idea is convert LiteDB to NetStandard to avoid compile/initialize to many platforms. FieldNames or property names are case-insensitive. LiteDB was inspired by the MongoDB database and its API is very similar to MongoDB’s official . 1. asakl changed the title [QUESTION] LiteDB-log [QUESTION] disable creation of LiteDB-log on Feb 10, 2020. May 16, 2018 · If you this parameter, LiteDB uses Flush (true) option after write on disk. In both instances (i. LiteDB stores DateTime with millisecond precision and truncates the nanoseconds. 3/2. You user decide to keep a single instance will get betters benefits about performance (as keeping pages in cache and keeping datafile (and journal) opened, and avoid first v1 problem about read inconsistent data when using same instance). The difference is: if flush = false and power off occurs AFTER database commit - this last transaction can be lost (but you program received OK for this transaction). For more info, chech the GROUP BY documentation below. // here, all database are in memory only. This affects how the engine opens the data file. (data is mostly like: db. Direct: The engine will open the datafile in exclusive mode and will keep it open until Dispose(). Thanks! mbdavid closed this as completed on Mar 10, 2018. From: Mauricio Davidmailto: notifications@github. We'll point out that this release is identified as non-production ready. FieldValues or property values are case-insensitive. db"); asakl added the question label on Feb 10, 2020. var data = col. 5 / NETStandard 1. Dispose() 於 LiteDB. 100% C# code for . github. SQLiteは良くも悪くもC LiteDB is a document database, so there is no JOIN between collections. Hi @FutureTD, as @maikebing say, it´s possible use LiteDB with any Stream - so, MemoryStream are supported. Max Primary Key Value Size: 1024 B Jan 15, 2020 · You signed in with another tab or window. SQLiteはライブラリ自体インストールするだけで約5MBくらいあったので全然Liteじゃなく実行ファイルを小さくしたい. This can be easily fixed by checking the db. Reload to refresh your session. var issuesToReturn = new List<Customer>(); try. using LiteDB; Nov 8, 2017 · mbdavid commented on Nov 8, 2017. using (var db = new LiteDatabase(_databaseFileName)) {. e. and this is GetAll. Successfully merging a pull request may close this issue. From LiteDb Studio (Text) Jan 4, 2018 · Hi @mbooh, LiteDB doesn't support Azure blobs because there is no IDiskService implementation for Azure. MemoryCache. } also found more examples of handling it the same way. First off, fantastic work on this project, very impressive. I have a LiteDB database with 2 POCO classes. To create a reference you can use [BsonRef] attribute or use theDbRef method from the fluent API mapper. You can load you file to memory and initialize LiteDB using MemoryStream and when you want persist in disk, write from memory to disk. Our application performs reads and writes from many different threads. even if you leave it there, the batches should be highly unpredictable. 18 Describe the bug We use a single IDatabase instance registered as singleton. Documents in formats such as PDF are created by merging data into the stored templates. org. So, if you do: Apr 6, 2023 · As shown below, I inserted an element into the document, and it automatically generated an _id of type Object for me. Qcode", "q104" )); This returns complete documents of the users with all the Qcodes. LiteDatabas Mar 16, 2017 · It's same problem found here: #532 (comment) I commited this change. IndexOutOfRangeException: Index was outside the bounds of the array. Xamarin and server side etc. LINQ expressions (lambda functions) can be used to create fluent API query in your C# code. Feb 25, 2018 · Pretty sure i'm using v4. NET MAUI supports database-driven applications using the SQLite database engine, which makes it possible to load and save objects in shared code. Oct 6, 2016 · English is not my natural language and I have a bit difficult to explain how LiteDB works. All SQL commands are supported in new LiteDB. MoveNext() 於 System. Apr 21, 2015 · We are currently using mongodb and if the doc size is more than 16MB then we store it as Blob. Exception: LiteDB ENSURE: pages in memory store must be non-shared at LiteDB. This feature was removed because now LiteDB supports full scan search too (search with no index). About share your converters, you can add as extenal file here in this issue. After receiving the data, database connection closes. Normally i do this on the collection with LINQ Mar 9, 2020 · System. Jan 10, 2017 · Yep, I can confirm that. Enumerable. A Serilog sink that writes events as documents to LiteDB. Fix #2435 Transactions are not removed in LiteDB 5. NET, let alone one that is serverless and easily integrated in an application. Since LiteDB is supposed to be thread-safe, I don't use locks to synchronize reads/writes to the DB. CheckpointSize property and, if necessary, changing it to another value (the default is 1000); LiteDB will lock second concurrency instance until first release (by Dipsose). Lock() method. travis. Hi @qqgg231, "auto index" is not the same "auto id". in name using (var liteDb = new LiteDB. I followed the source code until IndexService. I think the reason is to be compatible to JSON/BSON. ReleaseMutex() 於 LiteDB. The expected behavior is that the insert of a high number of records does not corrupt the database. keyword. The GROUP BY clause restricts the possible values in this clause. It is ideal for mobile apps or for small desktop/web apps, and its API is very similar to MongoDB C# Official Driver. Engine. yml you will generate a dependency free version of the LiteDb. 1 . Nov 27, 2018 · I'm kind of new to LiteDB. LiteDB improves search performance by using indexes on document fields or expressions. Just copy LiteDB. GetCollectionName(typeof(T). ApplicationException: Object synchronization method was called from an unsynchronized block of code 於 System. Nov 24, 2016 · Yes it's possible. I was comparing litedb against sqlite and noticed a rather large comparative file size. 0. Apr 19, 2019 · My first question is will the following be possible with LiteDB: Up to 20 instances of the program are accessing the database file over the network roughly at the same time and recevieve the data. Jul 1, 2018 · Now available on Stack Overflow for Teams! AI features where you work: search, IDE, and chat. Oct 18, 2016 · LiteDB stores the cross-referenced entities perfectly fine, but problem comes when I am trying to find/load entities back. NET Core API. In shared mode, any other can read but can't open new transactions. 2. いくつかの特徴はSQLiteともかぶっていると思いますが、個人的には以下の場合はLiteDBを使います。. Documents are a schema-less data structure. Version 5. LiteDB ENSURE: request page must be less or equals lastest page in data file System. db")); using (var db = new LiteDatabase(mem)) {. Collection names are case-insensitive. NET MAUI applications can read and write data to a local SQLite database using SQLite-net Jul 4, 2023 · Development. I want to get all the users containing specific QCode (ex: q104). Jun 24, 2024 · LiteDB is a library that helps you work with c# embedded database, you can also use litedb . The following structure defines the SQL insert syntax in LiteDB. I've seen this issue #597, but it doesn't look like our case. So please try to update a field in the Feb 13, 2018 · Existing frameworks provide abstraction from persistence and provide an interface for code sharing between platforms E. LiteDb v5 Query. MemoryStream stream = new MemoryStream(); Stream dest = File. Sinks. I can create a POCO, make a db connection and do a collection. stream. So unless you can bring your condition to the top level, the engine will have to unpack every single JSON object to get the managed array to apply your filter on Aug 5, 2020 · The Checkpoint pragma is set to 0, which disables auto-checkpoint (there used to be a bug that set it to 0 when upgrading LiteDB v4 datafiles to v5). Is there any way to get only specific Qcode from the embedded document with user detail from parent doc like. So yes, you can lost this last transaction. If T is not a BsonDocument, LiteDB internally maps your class to BsonDocument. Mutex. I have been using LiteDb for some of my smaller projects and I’ve got to tell you that so far it has beed satisfying. LiteCollection is a generic class that is used to manage collections in LiteDB. {filename. Learn more Explore Teams Hi @raizam, the main change in next version is transforma LiteDB in a thread safe database. Note: in V5 everything is case in-sensitive. Keyworks are case-insensitive. ENSURE(Boolean conditional, String message) at LiteDB. Package - Serilog. 18 hizume/LiteDB. Aug 3, 2020 · I am using LiteDB, and trying to improve performance. public class Book { [BsonId] public string Id { get; set; } public List<Author> Authors { get; set; } } public class Author { public Apr 8, 2020 · It seems to me that it would be nice if it were possible to save primitive types without casting to a type BsonDocument. EnterTransaction() The only static instance of LiteDb is created like this: var db = new LiteDbExt($"Filename={path}") Did I, by chance, misunderstand something in how I must manage concurrency in LiteDb? Your help would be really appreciated. This situation is best option because there is no datafile checks between operations. . You signed in with another tab or window. Each document stores both its data and its structure. FullName);//here to delete the . You will see that you can not commit the transaction as it still contains open cursors. SHARED - When the first client calls BeginTrans() data file locks to shared mode. Dispose(Boolean disposing) 於 LiteDB. Simple API, similar to MongoDB. Constants. LiteDB has "Include" option (which is called before Max Index Value Size: 1024 B (after BSON Serialisation) Up to 255 indexes per collections, including the _id primary key, but limited to 8096 bytes for index definition. how I can create a database without the log file? the c# code is: var db = new LiteDatabase(@"DB. It is the complete document store solution in PowerShell, batteries included. net core. Without an index, LiteDB must execute a query using a full document scan. The LiteDB mapper converts POCO classes documents. You can use embedded documents (sub-documents) or create a reference … Connection String Jul 2, 2020 · You cannot use SELECT $ with GROUP BY because $ refers to the current document being iterated through before grouping. Page Type: Empty. Source code hosted on GitHub or Download Binary. Adding a Form_Load event handler, then declare variables as shown below. a batch of 1 record, then a batch of 10 records, then a batch of 2 records, then a batch of 1 record. INSERT INTO {collection} [: {autoIdType}] …. Author that includes " Id " and " Name ", as Properties. I'm planning future version to works as an server service too, so will be Feb 10, 2018 · mbdavid commented on Feb 13, 2018. If you are running in a web environment, make sure that your IIS user has write permission to the data folder. I like it very much ! And there is my problem: User public class User { [Key, DatabaseGenerated(DatabaseGeneratedOption. Insert(). LiteDB | Platforms - netstandard2. Or, if you prefer, you can install via NuGet: Install-Package LiteDB. The datafile cannot be opened by another process. But we want embedded database. LiteQueryable`1. Unspecified, So my partner and i ( one in Tokyo and one in HK )can see the same value in LiteDb Studio/ C# program , also can do Query have same result. If you want to retrieve an array of all documents that were grouped, use *; The field SHA is the grouping expression, and due to a limitation in LiteDB, you can only access the grouping expression in your projection by using Dec 21, 2023 · Expected behavior. I've made a test (on a WPF app) that connects 100 clients, each in a separate task. 0, net8. dll into your Bin folder and add it as Reference. Insert(T entity) The following errors occured on my local development maschine when downloading the datafile from Azure and replacing it with mine. LiteDB is a document database, so there is no JOIN between collections. Development. EQ("quescode[*]. Mapping a reference on database initialization It seems that currently no native Vector Database exists (for use in AI applications) in C#/. Unlike SQLite, LiteDB is a document database. Jun 18, 2020 · Which is called by: LiteDB. applet. } May 17, 2018 · Hi, I'm trying to do a RegisterType for an enum type to convert it into an integer before saving it mainly to save on space. i. 3 and 2. The order from this skip/limit is based only in what index are used in this Query execution. This article is an overview about my database project LiteDB - a small, fast and free embedded . Sent: ‎21/‎04/‎2015 16:07. In addition, it supports an external file storage mechanism for blobs greater than 1MB. [Instance 1] running VS in debug mode; [Instance 2] running by double clicking the LiteDB. To do this, LiteDB uses the BsonMapper class: Apr 3, 2017 · This was apparently done in 3. LiteDB is serverless MongoDB-like database delivered in a single DLL (less than 350kb) fully written in . LiteDB. Version v5. 5, 4. Mar 19, 2017 · If you want to compile a dependency free . Exception: LiteDB ENSURE: request page must be less or equals lastest page in data file at LiteDB. NET NoSQL Document Store for . Find(LiteDB. Identity)] public ObjectId Id { get; set; } [DisplayN LiteDB is a document database, so there is no JOIN between collections. // Get a collection (or create, if doesn't exist) LiteDB is a small, fast and lightweight . I can send Dec 6, 2015 · It seems there is little document about how to delete a record! string key = DbHelper. I have a 21mb sqlite db (30mb of sql) with an index on the string key, ended up as 64mb before I even got to add the index. Code to Reproduce It does also not work with the LiteDB Studio. When I re-write all lock control system to v4 to solve concurrency problem (Unable to cast object of type 'LiteDB. May 23, 2019 · 2. You can insert, update, delete or query your database using a very similar SQL relational language. As for example, this is implemented with an implicit identifier, which is created automatically if it is not in the specified type. 4 participants. Add insert bulk mbdavid#533 mbdavid#532. Got most things working. org Sep 8, 2017 · Hi @RytisLT,. db}" because it is being used by another process. 6 will be fully supported as well so future versions will be fine. The main purpose of keeping this fork is to meet my LiteDB use cases, refresh WPF knowledge, and share some improvements with the community. All this changes (an others more) are on database engine. This can easily be reproduced. Situation. Nov 16, 2022 · LiteDB is a document store that gets saved into a single file. Collections. Studio admin tool. Book that includes " Title " " Id " and " Author " (this property has a bson reference to the Author's collection) I'm trying to query the book collection in order to retrieve all authors named " John " that wrote one or more books. You switched accounts on another tab or window. Fix index DateTime #922. Jun 19, 2020 · LiteDb is a No-Sql engine, it stores data as blobs of JSON. Apr 13, 2018 · When I want to show my data in data grid view only first two columns are shown and data grid view doesn't show last two columns which are array. And Litedb suits best. You signed out in another tab or window. First, about my tests about performance: it's was using v3 (dev branch), Still under development and works diferent from v1 and v2. GetCollection<T>, T will be your document type. Jan 16, 2024 · I can read all data but it is not possible to change values. Now I need to get the most recently added record so I can pull a value from it and increment it in a pattern. Also, LiteDB will support multi key index (index all values from an array document field). Holding 50k+ rows with a lengthy string value for an enum seems like a bit of a waste to me. LiteDB supports SQL-like language for data and structure manipulations. No branches or pull requests. The only way to get a sorted data (using an index) is when you get operation like All , `>´, ´<´ so I start searching data from begin to end (ASC) or end to begin (DESC). When you get a ILiteCollection<T> instance from LiteDatabase. Apr 17, 2020 · @mdmoura Regarding a, what I believe is happening is that you're using autoid for tags (by not setting an Id value for your tags, LiteDB creates one automatically upon insertion) and it doesn't know that the "Europe" tag in the first post and the "Europe" tag in the same post are actually the same, and ends up inserting it twice. Maybe in v3. Each collection must have a unique name: The total size of all the collections names in a database is limited to 8000 bytes. 9 participants. All() equivalent. Object Mapping. Showing LiteDB database items in data grid view. Threading. var accountCollection = db. A select expression can be: A literal of any BSON type that LiteDB supports; A valid JSON path; A function over literals or JSON paths. Data recovery after write failure (WAL log file) LiteDB is a noSQL singlefile datastore just like SQLite. More examples and online shell at LiteDB. This is a pre-release. Those examples are more like demo projects though, was not able to find a real project. <ToDocuments>d__26. ConnectionString)) {. ACID with full transaction support. More precisely, that it should be implemented inside LiteDb. I currently have two queries on the same table, and was wondering if there is another way to combine these two queries as one to improve performance. SQLite has tables, which have rows and columns. That means that all your data resides in a single file. Linq. g. In my case, actually need store as DateTimeKind. PS: you really made a good good job with LiteDb!! See full list on litedb. db. {. GetCollection LiteDB stores data as documents, which are JSON-like objects containing key-value pairs. LiteDB stores documents in collections. NET in a single datafile - and now it's in new version 4. CloseDatabase() 於 LiteDB. As of 2018. Auto Id is like "Auto Increment" in sql Apr 18, 2016 · carlokok commented on Apr 18, 2016. LiteDB implement 3 modes of locking: UNLOCKED - No locks on data file - any client can read or write data. LiteDB multiple queries in C#. If you plan to have many collections in your database, make sure to use short Apr 21, 2018 · Consider the following: public class UniqueValueModel { public int Id { get; set; } public string Value { get; set; } } var collection = _db. Find. Back to LiteDB: Skip/Limit in Query command is useful to avoid deserialize document that you will not use. My goal is NOT ONLY the requested entity but also referenced ones. Interesting fact: it was just once since November 2017, and gone after app Nov 23, 2023 · A very typical application for the variety of components that are part of TX Text Control is the visual creation of templates that are stored in a database. If you remember the good old times’ citation needed, you might remember SQL Server Compact , a single file database based on the SQL Server. Just begin a transaction on the database and run a 'FindById' operation on a collection. Studio. To store the templates, this sample application uses a file-based database called LiteDB. db and DB-log. com. NET 4. Using LiteDB in an ASP. Animha. LiteDB offers 2 types of connections: Direct and Shared. LiteEngine. May 25, 2015 · LiteDB has only indexed fields that can be used to Find results in ASC or DESC order (use a skip-list index structure). 7 Describe the bug A specific collection gets corrupted and trying to access it throws this: LiteException: "Invalid Collection on 0. WhereSelectEnumerableIterator Jan 30, 2017 · Saved searches Use saved searches to filter your results more quickly Nov 25, 2022 · Unhandled exception. Thanks for your LiteDB. PSLiteDB is a PowerShell wrapper for LiteDB. 1. Jan 21, 2021 · How to Join In LiteDb. 0 in a single DLL (less than 450kb) Thread-safe. Apr 24, 2020 · It might have to do with #1622 which I also experience or it might have to do with concurrent multi-threaded access to the collection. LockService. No changes to the database are made. 1 DLL. Is possible to create this implementation, but I do not recommend. Nobody is going to get an SSD just for using LiteDB. LiteDB works nice only if you have access to your local disk, because it's based on filesystem. // insert some values. Mar 1, 2018 · Database is locked for more than 00:01:00. Serverless NoSQL Document Store. mbdavid added a commit that referenced this issue on Mar 17, 2018. Mar 6, 2016 · If has an index in Title, DBMS will get order from index, and load only 3 records. all this has same Oct 1, 2018 · LiteDB is a simple, fast and lightweight embedded . It looks like it is not checking each value. Current version also support "Temp" stream: use MemorySteam until 10Mb, if pass this limit, store in temp windows directory and auto delete when close. There is quick tutorial section "DbRef for cross references" on LiteDB webpage how one can realize it. You can use embedded documents (sub-documents) or create a reference between collections. Next, I can read directly from disc, convert into a BsonDocument and insert the records at 1000 entries per BsonDocument array. https Mar 22, 2015 · Concurrency is guaranteed by locking your data file using FileStream. The default collection name is log, but a custom collection can be supplied with the optional CollectionName parameter. Stacktrace. Shared mode support many processes (app domains) open same datafile and you can have multiples LiteDatabase instances across processes. Sep 22, 2020 · at LiteDB. At the moment, AOT compilation is not supported for LiteDB (Linq expressions not support compilation in AOT builds, and reflections, as I understand it, are not supported). Snapshot Jun 3, 2020 · LiteDb use LocalTime for do Query, so if the timezone is different the query result may not be the same. These occured when inserting an entity, but only in about 1 of 5. So how do I use the existing model to get the value of this _id? using LiteDB; using (var db = new LiteDatabase(@"C:\litedb\test. Query. The Problem is that the changes made to the database are not written to the stream. Full zero: True. Sent from my Windows Phone. Each index uses: 41 bytes + LEN (name) + LEN (expression) - So if you have a two letter name for each index the maximum index count is 188. My laptop has only a SSD, I do not have another disk to Jan 13, 2016 · In PowerShell, for LiteDB databases you can use the module Ldbc. BsonExpression s can either be used natively (there is an implicit conversion between string and BsonExpression ) or by mapping a lambda expression (methods that take a lambda expression do this automatically). HeaderPage') I tried to keep as simple as possible: removing transaction, external journal file, adding find cursor, . Applet. 3. JsonNet project. NET 3. Each index storess the value of a specific expression ordered by the value (and type). fs do sg an jj vt tc yx yj zm